fix: add extra invalidate after pinning and unpinning request
This commit is contained in:
parent
af9acd1bf7
commit
810948242f
|
@ -1,4 +1,4 @@
|
||||||
import { useNotification } from "@refinedev/core";
|
import { useInvalidate, useNotification } from "@refinedev/core";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useCallback, useContext } from "react";
|
import { useCallback, useContext } from "react";
|
||||||
import { PinningProcess } from "~/data/pinning";
|
import { PinningProcess } from "~/data/pinning";
|
||||||
|
@ -6,6 +6,7 @@ import { PinningContext } from "~/providers/PinningProvider";
|
||||||
|
|
||||||
export const usePinning = () => {
|
export const usePinning = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
const invalidate = useInvalidate();
|
||||||
const context = useContext(PinningContext);
|
const context = useContext(PinningContext);
|
||||||
const { open } = useNotification();
|
const { open } = useNotification();
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ export const usePinning = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
queryClient.invalidateQueries({ queryKey: ["pin-progress", "file"] });
|
queryClient.invalidateQueries({ queryKey: ["pin-progress", "file"] });
|
||||||
|
invalidate({ resource: "file", invalidates: ["list"] });
|
||||||
return Promise.resolve(response);
|
return Promise.resolve(response);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -44,6 +46,7 @@ export const usePinning = () => {
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
queryClient.invalidateQueries({ queryKey: ["pin-progress"] });
|
queryClient.invalidateQueries({ queryKey: ["pin-progress"] });
|
||||||
|
invalidate({ resource: "file", invalidates: ["list"] });
|
||||||
return Promise.resolve(response);
|
return Promise.resolve(response);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue