mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 00:26:01 +00:00
refactor(dropzone): extract DropzoneInner and unify state management with zustand (#165)
Simplified Dropzone implementation by extracting inner logic to a new component, `DropzoneInner`. Replaced local dropzone state logic with centralized state management using zustand. Adjusted API exports and props accordingly for consistency and maintainability.
This commit is contained in:
@@ -112,8 +112,8 @@ export const useEntityQuery = <
|
||||
...options,
|
||||
});
|
||||
|
||||
const mutateAll = async () => {
|
||||
const entityKey = makeKey(api, entity as string);
|
||||
const mutateFn = async (id?: PrimaryFieldType) => {
|
||||
const entityKey = makeKey(api, entity as string, id);
|
||||
return mutate((key) => typeof key === "string" && key.startsWith(entityKey), undefined, {
|
||||
revalidate: true,
|
||||
});
|
||||
@@ -126,7 +126,7 @@ export const useEntityQuery = <
|
||||
|
||||
// mutate all keys of entity by default
|
||||
if (options?.revalidateOnMutate !== false) {
|
||||
await mutateAll();
|
||||
await mutateFn();
|
||||
}
|
||||
return res;
|
||||
};
|
||||
@@ -135,7 +135,7 @@ export const useEntityQuery = <
|
||||
return {
|
||||
...swr,
|
||||
...mapped,
|
||||
mutate: mutateAll,
|
||||
mutate: mutateFn,
|
||||
mutateRaw: swr.mutate,
|
||||
api,
|
||||
key,
|
||||
|
||||
Reference in New Issue
Block a user