Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onNodesDelete/onEdgesDelete triggered everytime deleteKeyCode is pressed #1987

Closed
alessandropisu opened this issue Mar 18, 2022 · 2 comments
Closed

Comments

@alessandropisu
Copy link

Describe the Bug

The callbacks onNodesDelete and onEdgesDelete in Uncontrolled mode are triggered not only when some nodes/edges are selected and user press the deleteKeyCode (Backspace for example) but also when there aren't elements selected so basically everytime deleteKeyCode is pressed with focus on component

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Press on to have focus on it, then press the key set to delete elements (default is Backspace). You will receive as callback value for onNodesDelete/onEdgesDelete an empty array

Expected behavior

No callback events should be triggered if no elements are deleted

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: v10

Additional context

No response

@AndrewRayCode
Copy link

On version 10, pressing the backspace key also fires onEdgesChange multiple times and if you hold down backspace, triggers

Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
    at StoreUpdater (webpack-internal:///./node_modules/react-flow-renderer/dist/esm/index.js:1027:20)

@moklick
Copy link
Member

moklick commented Mar 23, 2022

thanks for the report @alessandropisu ! This is fixed in v10.0.5

@moklick moklick closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants