Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): use atomic selectors to fix Zustand v5 infinite loop (#28977)

yyh626d4f3e356f
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 6fba10bf813..682e91ea81f 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<string, any> = {}
diff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsx
index 11492539dfb..4c9de03b8a3 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<StartNodeType>()
const files = useStore(s => s.files)