From 55b12d7329b3451035036d4bd80e0f2cebaf0c4f Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 24 Oct 2024 07:47:20 -0700 Subject: [PATCH] Try fix for template tags not re-fetching on Windows --- src-web/hooks/useTemplateFunctions.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src-web/hooks/useTemplateFunctions.ts b/src-web/hooks/useTemplateFunctions.ts index 7bbea0b5..1e7eb783 100644 --- a/src-web/hooks/useTemplateFunctions.ts +++ b/src-web/hooks/useTemplateFunctions.ts @@ -8,11 +8,12 @@ export function useTemplateFunctions() { const result = useQuery({ queryKey: ['template_functions', pluginsKey], + // NOTE: visibilitychange (refetchOnWindowFocus) does not work on Windows, so we'll rely on mount to + // refetch template functions for us when. This should handle the case where the plugin system isn't + // quite ready the first time this is invoked. + refetchOnMount: true, queryFn: async () => { - const responses = (await invokeCmd( - 'cmd_template_functions', - )) as GetTemplateFunctionsResponse[]; - return responses; + return invokeCmd('cmd_template_functions'); }, });