Refactor plugin manager and gRPC server (#96)

This commit is contained in:
Gregory Schier
2024-09-19 05:58:12 -07:00
committed by GitHub
parent 844d795014
commit a3b64423fd
27 changed files with 661 additions and 614 deletions

View File

@@ -1,10 +1,13 @@
import { useQuery } from '@tanstack/react-query';
import type { GetTemplateFunctionsResponse } from '@yaakapp/api';
import { invokeCmd } from '../lib/tauri';
import { usePluginsKey } from './usePlugins';
export function useTemplateFunctions() {
const pluginsKey = usePluginsKey();
const result = useQuery({
queryKey: ['template_functions'],
queryKey: ['template_functions', pluginsKey],
queryFn: async () => {
const responses = (await invokeCmd(
'cmd_template_functions',
@@ -13,6 +16,5 @@ export function useTemplateFunctions() {
},
});
const fns = result.data?.flatMap((r) => r.functions) ?? [];
return fns;
return result.data?.flatMap((r) => r.functions) ?? [];
}