mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
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:
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user