NetLogo / Galapagos

NetLogo model simulation visualizer (Beak) and the netlogoweb.org website 🐢
https://netlogoweb.org/
Other
62 stars 42 forks source link

Deleting multiple plot widgets can cause an unhandled exception #424

Closed LaCuneta closed 2 months ago

LaCuneta commented 4 months ago

Discovered in the model PNoM 4 Virtual Syringe Force Graph. Just open it up, go to authoring mode, delete the top plot, then delete the lower plot. The lower plot will not delete and an exception will be thrown:

Uncaught TypeError: Cannot read properties of undefined (reading 'type')
    at WidgetController.removeWidgetById (widget-controller.js:127:51)
    at Ractive.unregisterWidget (event-traffic-control.js:256:16)
    at Ractive.caller (ractive.js:9195:40)
    at notifySubscribers (ractive.js:7243:55)
    at fireEventAs (ractive.js:7211:18)
    at fireEventAs (ractive.js:7228:14)
    at fireEvent (ractive.js:7197:10)
    at Child.Ractive$fire [as fire] (ractive.js:8311:10)
    at Object.action (contextable.js:20:28)
    at Child.eval (eval at fromExpression (ractive.js:1791:10), <anonymous>:3:42)

The wrong widget ID is getting passed in for the second delete, but that's as far as I tracked the problem. I did try deleting other widgets and they all seemed okay, it was just plots that had the issue.