Skip to content

Commit

Permalink
check in scope for state based on Tandem, #193 phetsims/states-of-mat…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Aug 19, 2020
1 parent 8f7a642 commit 02cd469
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/PhetioDynamicElementContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ class PhetioDynamicElementContainer extends PhetioObject {
const phetioStateEngine = phet.phetio.phetioEngine.phetioStateEngine;

// On state start, clear out the container and set to defer notifications.
phetioStateEngine.onBeforeStateSetEmitter.addListener( ( state, isInStateScope ) => {
phetioStateEngine.onBeforeStateSetEmitter.addListener( ( state, scopeTandem ) => {

// Only clear if this PhetioDynamicElementContainer is in scope of the state to be set
if ( isInStateScope( this.tandem ) ) {
if ( this.tandem.hasAncestor( scopeTandem ) ) {
this.clear( { fromStateSetting: true } );
this.setNotificationsDeferred( true );
}
Expand Down

0 comments on commit 02cd469

Please sign in to comment.