From 2dd9c64d34f345c47c33bfab30f2e143a6071438 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 Nov 2024 16:42:32 +0800 Subject: [PATCH] chore: use query --- .../workflow/block-selector/tool-picker.tsx | 2 +- web/service/use-tools.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/web/app/components/workflow/block-selector/tool-picker.tsx b/web/app/components/workflow/block-selector/tool-picker.tsx index 3f1ffe4630..88e88018f1 100644 --- a/web/app/components/workflow/block-selector/tool-picker.tsx +++ b/web/app/components/workflow/block-selector/tool-picker.tsx @@ -51,7 +51,7 @@ const ToolPicker: FC = ({ const { data: buildInTools } = useAllBuiltInTools() const { data: customTools } = useAllCustomTools() - const { invalidate: invalidateCustomTools } = useInvalidateAllCustomTools() + const invalidateCustomTools = useInvalidateAllCustomTools() const { data: workflowTools } = useAllWorkflowTools() const handleAddedCustomTool = invalidateCustomTools diff --git a/web/service/use-tools.ts b/web/service/use-tools.ts index 05e18051f6..fb01888e7f 100644 --- a/web/service/use-tools.ts +++ b/web/service/use-tools.ts @@ -30,13 +30,11 @@ export const useAllCustomTools = () => { export const useInvalidateAllCustomTools = () => { const queryClient = useQueryClient() - return { - invalidate: () => { - queryClient.invalidateQueries( - { - queryKey: useAllCustomToolsKey, - }) - }, + return () => { + queryClient.invalidateQueries( + { + queryKey: useAllCustomToolsKey, + }) } }