From edbfe27eb18400158a5f5b753ba6102df6489a32 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 13 Nov 2024 15:17:22 +0800 Subject: [PATCH] chore: add invalid all built in tools --- web/service/use-tools.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/service/use-tools.ts b/web/service/use-tools.ts index 3c34de3be9..ee2af1f398 100644 --- a/web/service/use-tools.ts +++ b/web/service/use-tools.ts @@ -12,13 +12,24 @@ import { const NAME_SPACE = 'tools' +const useAllBuiltInToolsKey = [NAME_SPACE, 'builtIn'] export const useAllBuiltInTools = () => { return useQuery({ - queryKey: [NAME_SPACE, 'builtIn'], + queryKey: useAllBuiltInToolsKey, queryFn: () => get('/workspaces/current/tools/builtin'), }) } +export const useInvalidateAllBuiltInTools = () => { + const queryClient = useQueryClient() + return () => { + queryClient.invalidateQueries( + { + queryKey: useAllBuiltInToolsKey, + }) + } +} + const useAllCustomToolsKey = [NAME_SPACE, 'customTools'] export const useAllCustomTools = () => { return useQuery({