phetsims / energy-skate-park-basics

"Energy Skate Park: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/energy-skate-park-basics
GNU General Public License v3.0
2 stars 9 forks source link

"Assertion failed: Impossible set state" because of Nodes #395

Closed zepumph closed 6 years ago

zepumph commented 6 years ago

Just like in https://github.com/phetsims/charges-and-fields/issues/142, this problem is happening here in the state wrapper when you click on a control point with the UI buttons that pop up. \

Assertion failed: Impossible set state:
energySkateParkBasics.playgroundScreen.view.trackNode_5.controlPointNode_2.controlPointUI

@samreid could you apply the same strategy for this?

samreid commented 6 years ago

The problem is that this logic is used to create ControlPointUI in the source frame:

        if ( dragEvents <= 3 && trackNode.parents.length > 0 ) {

That logic never gets called in the downstream sim and hence the control point UI isn't created there. We need a more model-driven approach or a way to clearChildInstances and create these from scratch. But maybe these control points are "transient" and not necessary for the state? It is a question for https://github.com/phetsims/phet-io/issues/1238

samreid commented 6 years ago

I got partway through implementing this only to discover that the downstream ControlPointNode has a TrackNode with no parents, so the reconstituted control point UI is not showing up.

samreid commented 6 years ago

I could use @zepumph's help on this.

zepumph commented 6 years ago

Marked as meeting. Unassigning until we get to it in the meeting.

samreid commented 6 years ago

I solved this in a related issue by removing the control node UI buttons from the state, closing.