mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-26 08:42:03 +08:00
fix: Delete folder from cache after successful deletion (#3686)
* feat: Delete folder from cache after successful deletion * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -18,7 +18,8 @@ export const useDeleteFolders: useMutationFunctionType<
|
||||
folder_id,
|
||||
}: DeleteFoldersParams): Promise<any> => {
|
||||
const res = await api.delete(`${getURL("FOLDERS")}/${folder_id}`);
|
||||
return res.data;
|
||||
// returning id to use it in onSuccess and delete the folder from the cache
|
||||
return folder_id;
|
||||
};
|
||||
|
||||
const mutation: UseMutationResult<
|
||||
@ -30,6 +31,12 @@ export const useDeleteFolders: useMutationFunctionType<
|
||||
onSettled: () => {
|
||||
queryClient.refetchQueries({ queryKey: ["useGetFolders"] });
|
||||
},
|
||||
onSuccess: (id) => {
|
||||
queryClient.removeQueries({
|
||||
queryKey: ["useGetFolder", { id }],
|
||||
exact: true,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return mutation;
|
||||
|
||||
Reference in New Issue
Block a user