From 626d4f3e356fefede5937bd23551b9a2d0e5e5c0 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Mon, 1 Dec 2025 15:45:50 +0800 Subject: [PATCH] fix(web): use atomic selectors to fix Zustand v5 infinite loop (#28977) --- .../workflow/panel/debug-and-preview/chat-wrapper.tsx | 6 ++---- web/app/components/workflow/panel/inputs-panel.tsx | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx b/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx index 6fba10bf81..682e91ea81 100644 --- a/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx +++ b/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx @@ -47,10 +47,8 @@ const ChatWrapper = ( const startVariables = startNode?.data.variables const appDetail = useAppStore(s => s.appDetail) const workflowStore = useWorkflowStore() - const { inputs, setInputs } = useStore(s => ({ - inputs: s.inputs, - setInputs: s.setInputs, - })) + const inputs = useStore(s => s.inputs) + const setInputs = useStore(s => s.setInputs) const initialInputs = useMemo(() => { const initInputs: Record = {} diff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsx index 11492539df..4c9de03b8a 100644 --- a/web/app/components/workflow/panel/inputs-panel.tsx +++ b/web/app/components/workflow/panel/inputs-panel.tsx @@ -32,10 +32,7 @@ type Props = { const InputsPanel = ({ onRun }: Props) => { const { t } = useTranslation() const workflowStore = useWorkflowStore() - const { inputs } = useStore(s => ({ - inputs: s.inputs, - setInputs: s.setInputs, - })) + const inputs = useStore(s => s.inputs) const fileSettings = useHooksStore(s => s.configsMap?.fileSettings) const nodes = useNodes() const files = useStore(s => s.files)