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

Creator crashes when duplicating card with array component in bf-tests > twenty-card #236

Closed brettfiedler closed 3 weeks ago

brettfiedler commented 1 month ago

Try duplicating 2 Diamond. Crashes with:

phet-lib-main.js:32 Uncaught Error: Assertion failed: Reference component must be in the list of model components
    at window.assertions.assertFunction (phet-lib-main.js:32:51)
    at eval (ViewComponent.js:83:17)
    at Array.forEach (<anonymous>)
    at DescriptionViewComponent.setReferenceComponentNames (ViewComponent.js:82:29)
    at new ViewComponent (ViewComponent.js:47:10)
    at new DescriptionViewComponent (DescriptionViewComponent.js:11:5)
    at DescriptionViewComponent.fromStateObject (DescriptionViewComponent.js:19:12)
    at eval (ProgramViewContainer.js:165:100)
    at Array.forEach (<anonymous>)
    at ProgramViewContainer.load (ProgramViewContainer.js:164:22)
jessegreenberg commented 1 month ago

Also, program duplication involved a project with an array component.

brettfiedler commented 1 month ago

Ah, I think this actually might have to do with the reference feature, and may not involve the array component (though that may have other problems).

Ran into this in a project (bf-tests > multimodal-book) when trying to duplicate a project. One of the components (coverText) in the views is a reference instead of dependency. Crashed Creator.

image

image

Can reproduce easily by duplicating the lone program.

jessegreenberg commented 3 weeks ago

OK I think this should be fixed in the dev branch. Unit tests coming up.

jessegreenberg commented 3 weeks ago

OK, I merged this into the main branch. I tested by copying a program with a reference connection in a test project. I added some unit tests for this case. Then I created a copy of bf-tests/twenty-card jg-tests and copied the 2 Diamond program and have a reasonable looking copy with no crash.

Closing.