Hey all. I'm creating a custom node and I keep on seeing this: https://github.com/wbkd/react-flow/issues/1620
I've memo'd the component but still...
1 messages ยท Page 1 of 1 (latest)
Hey all. I'm creating a custom node and I keep on seeing this: https://github.com/wbkd/react-flow/issues/1620
I've memo'd the component but still...
Could you share some code for your node types object?
Are you defining it inside the body of a component, like this?
If so, it should be wrapped in useMemo as the post suggests
function SomeComponent() {
const nodeTypes = { .. }
// ...
}
Here's what I have so far:
Changing to this:
const nodeTypes = useMemo(() => {
return {
circle: memoCircleNode,
ResizableNodeSelected,
}
}, [])
Still gets the same error.
Mh... what version are you using?
"reactflow": "^11.7.0"
Every time I save. ๐
Save?
Yeah when React blows everything away and starts again.
Mh... can you possibly provide a minimal reproduction for this issue?
From the looks of it, the code seems fine so I'm not exactly sure what's up ๐
https://codesandbox.io/s/elegant-browser-ir7u4p?file=/src/flow.tsx
Just doing a console.log inside the main component gives the same error:
Seems like the issue is just caused by hot-reload and not really by the re-render of app itself mh
If I remove useMemo then the "real" issue that's documented starts, you get the warning spammed constantly in the console
Ok, so I can just safely ignore this then?
If there's no actual issues appearing in your app and you don't happen to end in some infinite-rerender loop, I'd say yes ๐
Awesome, many thanks for taking the time to answer my query! Much appreciated!