xyflow / xyflow

React Flow | Svelte Flow - Powerful open source libraries for building node-based UIs with React (https://reactflow.dev) or Svelte (https://svelteflow.dev). Ready out-of-the-box and infinitely customizable.
https://xyflow.com
MIT License
21.54k stars 1.43k forks source link

Can't get "nodeLookup" from useStoreApi() #4191

Closed LehanChancetop closed 3 weeks ago

LehanChancetop commented 3 weeks ago

Describe the Bug

I want to get "nodeLookup" form useStoreApi() ,but it get undefined. "getNodeRect", "getInternalNode" have the same problem form useReactFlow()

Your Example Website or App

https://codesandbox.io/p/sandbox/objective-brahmagupta-g4jd9q?file=%2FResizeRotateNode.js%3A48%2C46

Steps to Reproduce the Bug or Issue

index.js

 <StrictMode>
    <ReactFlowProvider>
      <App />
    </ReactFlowProvider>
  </StrictMode>

ResizeRotateNode.js

const { getNodeRect, getInternalNode, getNodes } = useReactFlow();
console.log("useReactFlow::", getNodeRect, getInternalNode, getNodes);

const state = useStoreApi();
console.log("nodeLookup", state.getState().nodeLookup);

getNodeRect, getInternalNode,nodeLookup is undefined

Expected behavior

I want use "nodeLookup" form state

Screenshots or Videos

No response

Platform

Additional context

No response

moklick commented 3 weeks ago

nodeLookup (and getInternalNode) is only available in v12 (package name 'xyflow/react'). The example uses v11 (package name 'reactflow').