pref: reduce the times of useNodes reRender (#28682)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Joel
2025-11-26 16:52:47 +08:00
committed by GitHub
parent d7010f582f
commit ef0e1031b0
18 changed files with 55 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ import {
useRef,
} from 'react'
import { useClickAway } from 'ahooks'
import { useNodes } from 'reactflow'
import useNodes from '@/app/components/workflow/store/workflow/use-nodes'
import PanelOperatorPopup from './nodes/_base/components/panel-operator/panel-operator-popup'
import type { Node } from './types'
import { useStore } from './store'
@@ -16,7 +16,6 @@ const NodeContextmenu = () => {
const { handleNodeContextmenuCancel, handlePaneContextmenuCancel } = usePanelInteractions()
const nodeMenu = useStore(s => s.nodeMenu)
const currentNode = nodes.find(node => node.id === nodeMenu?.nodeId) as Node
useEffect(() => {
if (nodeMenu)
handlePaneContextmenuCancel()