phetsims / paper-land

Build and explore multimodal web interactives with pieces of paper!
https://phetsims.github.io/paper-land/
MIT License
10 stars 1 forks source link

Strange connection bug when creating from template #212

Closed jessegreenberg closed 3 months ago

jessegreenberg commented 5 months ago

While in a demo today, extra connections were made from a template that we didn't expect. We created from the "described grid" template. Ill investigate why that happened.

I believe relationships between components were not removed correctly and so they were set up immediately again when the component was added.

jessegreenberg commented 5 months ago

THis was observed in phet-creator-sims > electric-field-hockey project.

jessegreenberg commented 3 months ago

I can reproduce this pretty easily by doing this:

1) Create a new project 2) Create the "Described Grid" template. 3) Delete the "Movable Cupcake" and "Movable Object" programs. 4) Create the "Described Grid" template again.

There will now be two "Bounds" programs and BOTH will have connections to the "Movable Object" program. That is not correct, only the newest "Bounds" program should have any connections.

EDIT:

After saving the project in this buggy state, reloading it shows the correct connections. So I believe this could just be an issue with the arrows display and not the connections themselves.

EDIT2: It actually is a connections problem. It seems that the description view component from the deleted "Movable Object" component is NOT getting removed from CreatorModel.allViewComponents

jessegreenberg commented 3 months ago

Fixed in the above commit. Deleting a program actually did not remove components from the CreatorModel components lists. I am actually surprised that this didn't manifest in bigger problems.

Lets add some unit tests for this before closing.

jessegreenberg commented 3 months ago

Done and merged into main.