retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10.17k stars 653 forks source link

App crashes when emitting nodeselect event #556

Closed jtwnel closed 1 year ago

jtwnel commented 3 years ago

Hi,

I tried to trigger the "nodeselect" event on the "nodecreated" event handler but it crashes saying the following error Unhandled Rejection (Error): Node not exist in list. How is this possible? if the node is already visible it does not make sense to get this error.

this is a snippet of what i'm trying to do

editor.current.on('nodecreated', (node) => { function_calls... editor.current.trigger('selectnode', node); });

Thanks in advance

Ni55aN commented 3 years ago

Definitely, the node was deleted before triggering selectnode, since nodes array doesn't have this node anymore

https://github.com/retejs/rete/blob/6bdec4f575e7ba5690fe673a6547270863b5013a/src/editor.ts#L85-L87

rete-js[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.