From c00fd248d2e8849fc5c78257dace29bbe39dd4f7 Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Wed, 24 Aug 2022 13:59:18 -0600 Subject: [PATCH] Allow instrumented DerivedProperties to update during PhET-iO state set, see https://github.com/phetsims/axon/issues/409 --- js/ReadOnlyProperty.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/ReadOnlyProperty.ts b/js/ReadOnlyProperty.ts index 3dcc3e7d..fffe8ec4 100644 --- a/js/ReadOnlyProperty.ts +++ b/js/ReadOnlyProperty.ts @@ -229,7 +229,10 @@ export default class ReadOnlyProperty extends PhetioObject implements TReadOn // state is managed by the PhetioStateEngine const setManagedByPhetioState = window.phet && phet?.joist?.sim?.isSettingPhetioStateProperty.value - && this.isPhetioInstrumented() && this.phetioState; + && this.isPhetioInstrumented() && this.phetioState + + // However, DerivedProperty should be able to update during PhET-iO state set + && this.isSettable(); if ( !setManagedByPhetioState ) { this.unguardedSet( value );