bcakmakoglu / vue-flow

A highly customizable Flowchart component for Vue 3. Features seamless zoom & pan πŸ”Ž, additional components like a Minimap πŸ—Ί and utilities to interact with state and graph.

Home Page:https://vueflow.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› [BUG]: deletKeyCode is reset after using the $reset function

mdominiak2 opened this issue Β· comments

Is there an existing issue for this?

  • I have searched the existing issues and this is a new bug.

Current Behavior

When we set deletKeyCode : null, and then we use the $reset function, deletKeyCode will be set to undefined. (After the reset you can delete nodes with a backspace key)

Expected Behavior

After setting deletKeyCode: null nodes should not be removed using the backspace key, even after using the $reset function

Steps To Reproduce

Reproduction: https://stackblitz.com/edit/nuxt-starter-mtksvn?file=pages%2Findex.vue

  1. Try to remove nodes with the backspace key
    Nodes are removed, but they should not.

Relevant log output

No response

Anything else?

No response

The $reset action resets the store back to it's defaults - so it is completely expected that your keycode would be overwritten again and set to whatever it has as a default value.
It doesn't set it to undefined either, it sets it back to deleteKeyCode: 'Backspace'.

So this is not a bug, this is the intended behavior.
If you want to reset your elements (i.e. remove them) just reset the ref you use to pass your elements in the first place and don't go resetting the whole store for it.