phetsims/gas-properties

Missing dependency for DerivedProperty

Closed this issue · 2 comments

Discovered in phetsims/axon#441 ...

Relevant code and fix in IdealGasLawContainer:

-   this.isOpenProperty = new DerivedProperty( [ this.lidIsOnProperty, this.lidWidthProperty ],
+   this.isOpenProperty = new DerivedProperty( [ this.lidIsOnProperty, this.lidWidthProperty, this.boundsProperty ],
-     ( lidIsOn, lidWidth ) => {
+     ( lidIsOn, lidWidth, bounds ) => {
        return !lidIsOn || this.getOpeningWidth() !== 0;
      } );

this.getOpeningWidth calls this.getOpeningLeft, which calls this.left, which is a getter that uses this.boundsProperty.

This needs to be tested before pushing.

In 699b3b8, @samreid added accessNonDependencies: true to temporarily silence this problem.

Fixed in the above commit. Closing.