fix(workflow): derive plugin install state in render

Remove useEffect-based sync of _pluginInstallLocked/_dimmed in workflow nodes to avoid render-update loops.\n\nMove plugin-missing checks to pure utilities and use them in checklist.\nOptimize node installation hooks by enabling only relevant queries and narrowing memo dependencies.
This commit is contained in:
yyh
2026-03-09 17:18:09 +08:00
parent e845fa7e6a
commit f6d80b9fa7
13 changed files with 185 additions and 141 deletions

View File

@ -32,10 +32,11 @@ export const useInvalidateAllToolProviders = () => {
}
const useAllBuiltInToolsKey = [NAME_SPACE, 'builtIn']
export const useAllBuiltInTools = () => {
export const useAllBuiltInTools = (enabled = true) => {
return useQuery<ToolWithProvider[]>({
queryKey: useAllBuiltInToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/builtin'),
enabled,
})
}
@ -44,10 +45,11 @@ export const useInvalidateAllBuiltInTools = () => {
}
const useAllCustomToolsKey = [NAME_SPACE, 'customTools']
export const useAllCustomTools = () => {
export const useAllCustomTools = (enabled = true) => {
return useQuery<ToolWithProvider[]>({
queryKey: useAllCustomToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/api'),
enabled,
})
}
@ -56,10 +58,11 @@ export const useInvalidateAllCustomTools = () => {
}
const useAllWorkflowToolsKey = [NAME_SPACE, 'workflowTools']
export const useAllWorkflowTools = () => {
export const useAllWorkflowTools = (enabled = true) => {
return useQuery<ToolWithProvider[]>({
queryKey: useAllWorkflowToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/workflow'),
enabled,
})
}
@ -68,10 +71,11 @@ export const useInvalidateAllWorkflowTools = () => {
}
const useAllMCPToolsKey = [NAME_SPACE, 'MCPTools']
export const useAllMCPTools = () => {
export const useAllMCPTools = (enabled = true) => {
return useQuery<ToolWithProvider[]>({
queryKey: useAllMCPToolsKey,
queryFn: () => get<ToolWithProvider[]>('/workspaces/current/tools/mcp'),
enabled,
})
}