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

Delete node on user action only #196

Open
DrAmin opened this issue Aug 8, 2020 · 1 comment · May be fixed by #197
Open

Delete node on user action only #196

DrAmin opened this issue Aug 8, 2020 · 1 comment · May be fixed by #197

Comments

@DrAmin
Copy link

DrAmin commented Aug 8, 2020

We have integrated this library in our project, all the functionalities working fine. but we are facing issue while deleting node based on user action. Currently, user can delete node via Backspace and Delete button, but, it causes issue in our requirement so, we want to give button to delete node and for that, we referred your Selected-sidebar demo but, this demo has same issue.

Can you please help us to solve this problem?

Thank You.

@davidanitoiu
Copy link

davidanitoiu commented Aug 8, 2020

The culprit is line 183 here. It's missing a null-check.

https://github.com/MrBlenny/react-flow-chart/blob/master/src/container/actions.ts

if (config.readonly) {
    return chart
  }

Should be something like

if(config && config.readonly)

onDeleteKey takes an argument of the type IConfig. Which is not passed in the story you mentioned.
Easiest workaround for you, while this is fixed, would be to just do this:

const config = { readonly: false }
...
<Button onClick={() => stateActions.onDeleteKey({config})}>Delete</Button>

@davidanitoiu davidanitoiu linked a pull request Aug 8, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants