Try fix for template tags not re-fetching on Windows

This commit is contained in:
Gregory Schier
2024-10-24 07:47:20 -07:00
parent f4240e5229
commit 55b12d7329

View File

@@ -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<GetTemplateFunctionsResponse[]>('cmd_template_functions');
},
});