phetsims / build-a-nucleus

"Build a Nucleus" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
0 stars 5 forks source link

CT: Uncaught TypeError: Cannot read properties of undefined (reading 'setPositionAndDestination') #72

Closed veillette closed 1 year ago

veillette commented 1 year ago
build-a-nucleus : fuzz : built
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000
Query: fuzz&memoryLimit=1000
Uncaught TypeError: Cannot read properties of undefined (reading 'setPositionAndDestination')
TypeError: Cannot read properties of undefined (reading 'setPositionAndDestination')
at <unknown> (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:1712169)
at Array.forEach
at <unknown> (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:1712048)
at Array.forEach
at e (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:1712030)
at ey.reconfigureNucleus (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:1712403)
at <unknown> (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:1603930)
at r.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:23635)
at p._notifyListeners (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:17956)
at p.unguardedSet (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1673441522029/build-a-nucleus/build/phet/build-a-nucleus_en_phet.html?continuousTest=%7B%22test%22%3A%5B%22build-a-nucleus%22%2C%22fuzz%22%2C%22built%22%5D%2C%22snapshotName%22%3A%22snapshot-1673441522029%22%2C%22timestamp%22%3A1673448230895%7D&fuzz&memoryLimit=1000:975:17456)
id: Bayes Puppeteer
Snapshot from 1/11/2023, 7:52:02 AM
veillette commented 1 year ago

The problems lies with reconfigureNucleus()


nucleonShellPosition.particle = particleArray[ nucleonIndex ];
...
nucleonShellPosition.particle.setPositionAndDestination( viewDestination );

but sometimes nucleonShellPosition.particle is undefined.

A bandaid solution would be :

nucleonShellPosition.particle = particleArray[ nucleonIndex ];             
if ( nucleonShellPosition.particle ) {
  nucleonShellPosition.particle.setPositionAndDestination( viewDestination );
}

@Luisav1 and @marlitas may have more insights about the failure.

marlitas commented 1 year ago

Hmmm... this should not be happening and we will definitely look into it...By the time it arrives at setPositionAndDestination a particle would have been set previously... this may be an order dependency problem that we have run into before.

marlitas commented 1 year ago

This error is no longer occurring after some refactoring. Closing.