phetsims / number-suite-common

"Number Suite Common" contains code for use by sims that are part of the Number Suite
GNU General Public License v3.0
0 stars 0 forks source link

support ?shuffleListeners #57

Closed zepumph closed 1 year ago

zepumph commented 1 year ago

From https://github.com/phetsims/axon/issues/215

zepumph commented 1 year ago

A brief investigation seems helpful and nice.

zepumph commented 1 year ago

In LabModel we are depending on a listener order to make sure the tenFrames are disposed before the tenFrame view:

https://github.com/phetsims/number-suite-common/blob/83359d28b58447537ab7e44d92543a503c6ef9c9/js/lab/model/LabModel.ts#L70-L72

Plus an assertion here in the view that will dispose from the same list: https://github.com/phetsims/number-suite-common/blob/78a13c1708d1296aa91e462bb1cdaaba705ef723/js/lab/view/LabScreenView.ts#L210

It seems worse to manually dispose each time we change the array (right now just in one place + on reset/clear). I am inclined to approve of this MVC listener order dependency.


@samreid and I talked and I realized from it that MVC is much better if the view listens to the disposal of the tenFrame model instead of the removal from the list (which is what the model disposal listens to).

Dependency removed, closing