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.

refactor: update useNodes import to use reactflow across multiple components (#29195)

Wu Tianweie7c26a2f3fd6
diff --git a/web/app/components/workflow/nodes/assigner/hooks.ts b/web/app/components/workflow/nodes/assigner/hooks.ts
index 0f316c6aebc..d42fb8ee8a1 100644
--- a/web/app/components/workflow/nodes/assigner/hooks.ts
+++ b/web/app/components/workflow/nodes/assigner/hooks.ts
@@ -1,5 +1,5 @@
import { useCallback } from 'react'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { uniqBy } from 'lodash-es'
import {
useIsChatMode,
diff --git a/web/app/components/workflow/nodes/assigner/node.tsx b/web/app/components/workflow/nodes/assigner/node.tsx
index cf1896d2ba1..5e5950d7151 100644
--- a/web/app/components/workflow/nodes/assigner/node.tsx
+++ b/web/app/components/workflow/nodes/assigner/node.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react'
import React from 'react'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { useTranslation } from 'react-i18next'
import type { AssignerNodeType } from './types'
import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
diff --git a/web/app/components/workflow/nodes/document-extractor/node.tsx b/web/app/components/workflow/nodes/document-extractor/node.tsx
index 9f1105b51a0..a0437a4f544 100644
--- a/web/app/components/workflow/nodes/document-extractor/node.tsx
+++ b/web/app/components/workflow/nodes/document-extractor/node.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react'
import React from 'react'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { useTranslation } from 'react-i18next'
import type { DocExtractorNodeType } from './types'
import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
diff --git a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
index 4a2d378aeff..82db6d15f89 100644
--- a/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
+++ b/web/app/components/workflow/nodes/if-else/components/condition-value.tsx
@@ -3,7 +3,7 @@ import {
useMemo,
} from 'react'
import { useTranslation } from 'react-i18next'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { ComparisonOperator } from '../types'
import {
comparisonOperatorNotRequireValue,
diff --git a/web/app/components/workflow/nodes/list-operator/node.tsx b/web/app/components/workflow/nodes/list-operator/node.tsx
index 5a6c5fe83f9..3c59f36587c 100644
--- a/web/app/components/workflow/nodes/list-operator/node.tsx
+++ b/web/app/components/workflow/nodes/list-operator/node.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react'
import React from 'react'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { useTranslation } from 'react-i18next'
import type { ListFilterNodeType } from './types'
import { isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
diff --git a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
index 96dfb5f52f8..e96475b9538 100644
--- a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
+++ b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx
@@ -3,7 +3,7 @@ import {
useMemo,
} from 'react'
import { useTranslation } from 'react-i18next'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { useStore } from '../../../store'
import { BlockEnum } from '../../../types'
import type {
diff --git a/web/app/components/workflow/nodes/variable-assigner/hooks.ts b/web/app/components/workflow/nodes/variable-assigner/hooks.ts
index 3b95ca6c415..29e0ee16d12 100644
--- a/web/app/components/workflow/nodes/variable-assigner/hooks.ts
+++ b/web/app/components/workflow/nodes/variable-assigner/hooks.ts
@@ -2,7 +2,7 @@ import { useCallback } from 'react'
import {
useStoreApi,
} from 'reactflow'
-import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
+import { useNodes } from 'reactflow'
import { uniqBy } from 'lodash-es'
import { produce } from 'immer'