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

Buttons for adding nucleons can get stuck in disabled state when shuffling listeners #172

Closed jbphet closed 1 year ago

jbphet commented 1 year ago

This was found during the "Does the sim behave correctly when listener order is shuffled?" step of the code review, see https://github.com/phetsims/build-a-nucleus/issues/165.

When testing with randomized listener order, the buttons for adding protons, neutrons, and both can be left in a disabled state after a reset.

To duplicate:

  1. Load the sim with the random seed 423809 (I saw this using several seeds, this is just one of them) and go into the "Decay" screen. The URL I used on my system was http://localhost:8080/build-a-nucleus/build-a-nucleus_en.html?brand=phet&ea&listenerOrder=random(423809).
  2. In quick succession, add two protons and then press the reset button
  3. All buttons for adding nucleons end up disabled, (see screenshot below), making the screen basically unusable

image

zepumph commented 1 year ago

Fixed over in #105. Thanks for the report. The bug was actually over in axon, where observableArray needed to lock in its lengthProperty listeners when it was marked as having order dependencies https://github.com/phetsims/axon/commit/4f571cbc738bdcba5f9f49050c3f2a1eddde9110