From 348628c4e5c48cd19f72a7109b34aaac8040518a Mon Sep 17 00:00:00 2001 From: AgustinVallejo Date: Fri, 5 Jan 2024 12:45:46 -0500 Subject: [PATCH] Slight improvement of code, see https://github.com/phetsims/my-solar-system/issues/327 --- js/common/model/MySolarSystemModel.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/js/common/model/MySolarSystemModel.ts b/js/common/model/MySolarSystemModel.ts index 9a8e1c6..7dd939c 100644 --- a/js/common/model/MySolarSystemModel.ts +++ b/js/common/model/MySolarSystemModel.ts @@ -181,12 +181,10 @@ export default class MySolarSystemModel extends SolarSystemCommonModel { } ); // Saving starting body info when phetioState is finished being set (turned false after being true) - let wasSettingPhetioState = false; - isSettingPhetioStateProperty.lazyLink( isSettingPhetioState => { + isSettingPhetioStateProperty.lazyLink( ( isSettingPhetioState, wasSettingPhetioState ) => { if ( !isSettingPhetioState && wasSettingPhetioState ) { this.saveStartingBodyInfo(); } - wasSettingPhetioState = isSettingPhetioState; } ); }