Closed matthew-blackman closed 1 year ago
@samreid @arouinfar and I agree that there should be a separate group for realLightBulbNodeGroup in the view, similar to how groups are being used for resistors, extremeResistors and householdObjects.
@arouinfar ready for testing. If all looks good, this can be closed.
Looks great, thanks!
I found in Studio there was an extra bulb socket like so:
So I added the commits above which seemed to fix it. Would be good to code review with @matthew-blackman. Was an extra archetype leaking? And testing to make sure the correct circuit element groups still appear in the appropriate circumstances (lab screen vs intro screen, and ac vs dc).
@matthew-blackman and I discovered phetioIsArchetype is undefined
for 2 of the light bulb types on Screen 1. We must find out the cause.
The problem is that PhetioObject.initializePhetioObject
has a guard and early return if providedOptions.tandem.supplied
is false. In this case, when we used the pattern of
initializeCircuitElementType( ( e: CircuitElement ) => e instanceof LightBulb && e.isReal, this.fixedCircuitElementLayer,
new PhetioGroup<CircuitElementNode, [ CircuitElement ]>( ( tandem: Tandem, circuitElement: CircuitElement ) => new CCKCLightBulbNode( screenView, this, circuitElement as LightBulb, this.model.isValueDepictionEnabledProperty, this.model.viewTypeProperty, tandem ),
() => [ this.circuit.realLightBulbGroup.archetype ], {
phetioType: PhetioGroup.PhetioGroupIO( Node.NodeIO ),
tandem: circuit.includeLabElements ? tandem.createTandem( 'realLightBulbNodeGroup' ) : Tandem.OPT_OUT,
supportsDynamicState: false
That part about tandem: circuit.includeLabElements ? tandem.createTandem( 'realLightBulbNodeGroup' ) : Tandem.OPT_OUT,
was creating a PhetioObject with a tandem that exists but is supplied: false
. Hence it never runs the phetioIsArchetype
assignment. Therefore, our solution that avoids creating these groups with Tandem.OPT_OUT
is the correct solution. Closing.
Fixed an assertion error that a group appeared twice. Closing.
Error message:
Assertion failed: phetioID already registered: circuitConstructionKitDc.labScreen.view.circuitNode.lightBulbNodeGroup.lightBulbNode_0
To reproduce: