mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
fix pagination if endpoint's total is not available
when using a connection that has softscans disabled (e.g. D1) pagination failed. Fixing it by overfetching and slicing
This commit is contained in:
@@ -14,10 +14,6 @@ export function useSearch<Schema extends s.Schema = s.Schema>(
|
||||
) {
|
||||
const searchString = useWouterSearch();
|
||||
const [location, navigate] = useLocation();
|
||||
const [value, setValue] = useState<s.StaticCoerced<Schema>>(
|
||||
options?.defaultValue ?? ({} as any),
|
||||
);
|
||||
|
||||
const defaults = useMemo(() => {
|
||||
return mergeObject(
|
||||
// @ts-ignore
|
||||
@@ -25,6 +21,7 @@ export function useSearch<Schema extends s.Schema = s.Schema>(
|
||||
options?.defaultValue ?? {},
|
||||
);
|
||||
}, [JSON.stringify({ schema, dflt: options?.defaultValue })]);
|
||||
const [value, setValue] = useState<s.StaticCoerced<Schema>>(defaults);
|
||||
|
||||
useEffect(() => {
|
||||
const initial =
|
||||
|
||||
Reference in New Issue
Block a user