From 73d930bd2eda4a28d54455253ec573ccb1496c0e Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Sat, 18 Feb 2023 04:05:25 -0700 Subject: [PATCH] Return null from VoltageConnectionIO.fromStateObject, see https://github.com/phetsims/circuit-construction-kit-common/issues/968 --- js/model/VoltageConnection.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/model/VoltageConnection.ts b/js/model/VoltageConnection.ts index 6ed08295..cf350453 100644 --- a/js/model/VoltageConnection.ts +++ b/js/model/VoltageConnection.ts @@ -33,6 +33,13 @@ export default class VoltageConnection { connection: ReferenceIO( IOType.ObjectIO ).toStateObject( voltageConnection.circuitElement || voltageConnection.vertex ), voltage: voltageConnection.voltage } ), + fromStateObject: stateObject => { + + // Like in DerivedProperty, this is a no-op because the value is not used to restore the state + // Will be recomputed after the model is restored. This code relies on the assumption that the VoltageConnectionIO + // is contained in a NullableIO() + return null; + }, stateSchema: { connection: ReferenceIO( IOType.ObjectIO ), voltage: NumberIO