xyflow: After a backup and restore, problem to create new handles dynamically.
Describe the Bug
My project is to create a custom node, this custom node contains a button that allows new handles to be created. This works fine, but when the flow is saved and restored, the new handles added to the same custom node are not connectable.
This error message appears until the node is deleted:
couldn't create edge for source handle id: dndnode_1649946748290_call_3_call_1649946788581; edge id: reactflow__edge-dndnode_1649946748290dndnode_1649946788581-dndnode_1649946778292
I already tried with this problem: #1641, but it did not solve my error, maybe I missed something
I noticed that the number of Handle I added and the number of handleBounds in the node are different after a restore, so I think this is a potential path to bug resolution. (You can see that on the screenshot)
Secondly, if a handle is removed, the edge remains and leads to errors, is it up to me to remove the edge programmatically?
0 -> 26 sec : The main issue 26 -> the end : The second question
Your Example Website or App
Here is the codesandbox link to my code, if you want to test it yourself: https://codesandbox.io/s/react-flow-issue-add-handles-after-restoring-k4uwgg
Steps to Reproduce the Bug or Issue
- Go to the sandbox code link above
- Drag and drop a “Custom Node” and an “Output Node” (the sidebar is at the bottom of the stream).
- Click on the “+ Add” button to add handles, you can create as many handles as you want.
- Link the handles of the custom node with the output node, each handle does not need to be linked.
- After that save with the green button (download icon) in the upper right corner.
- Refresh the page with F5 or the container.
- You will see the correctly restored stream
- Now create a new handle or handles and try to connect them to the output source.
The bug occurs if you go to the console an error message appears every time you change the node.
If you try to delete or link the two nodes with the handles created before the restore, this works as it should.
Expected behavior
As a user I expected to add new handles to my custom node after a restore but I can’t connect the new handles to nodes.
Screenshots or Videos

Platform
- OS: Linux
- Browser: Chrome
- Version: 10.1.0 & 10.0.8
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (4 by maintainers)
Commits related to this issue
- chore(internals): export symbol for accessing internals closes #2078 — committed to xyflow/xyflow by moklick 4 years ago
Sorry guys! We will export the symbol you need for accessing the
handleBounds!@alexanderhorner In v12 you can get an internal node using
getInternalNode, which contains the handle bounds.you can now do:
import { internalsSymbol } from 'react-flow-renderer';and then use it like:
const { handleBounds } = node[internalsSymbol];Thank you, @remibesset, for your help and suggestion! It works perfectly. Now this issue is not blocking me, though it would be better to have some kind of reliable documented API for this in the future.
So @stanislav-grin, after some research I find temporary fix which allow you to get back the
handleBoundsFor your specific case, I think that could work :
Hey @moklick I just tested and everything is fine, I will continue to test further. I think you can consider this issue as closed.
Hey @remibesset! Thanks for the bug report.
handleBoundswill no longer be exposed to the client. Could you check if the latest version 10.3.4 fixes your issue?