Closed samreid closed 6 months ago
I've been testing with these query parameters: http://localhost/collision-lab/collision-lab_en.html?brand=phet&ea&debugger&screens=1&listenerOrder=reverse&fuzz
This patch uncouples the DerivedProperty instances and seems to correct the fuzzing failure by avoiding the inconsistent intermediate state. I would like to request a review before committing.
@jbphet and @pixelzoom are listed as authors on NumberAccumulator, can one of you please volunteer to review? Feel free to commit if it is good.
The above patch looks OK to me. But I'm not really familiar with NumberAccumulator, so @jbphet should doublecheck.
A couple of other thoughts about the above patch:
(1) Add a comment that references this issue, so future devs will know why stringProperty is not used directly in the derivation.
(2) Consider moving stringProperty from NumberAcumulator to Keypad. That's the only place where it's currently used or needed. This would also eliminate the need for (1).
I've committed the patch that @samreid suggested. This seems like a reasonable way to work around the dependency issues. I then added the comment suggested in item 1 above from @pixelzoom. I didn't do item 2 because the accumulators were designed to be the encapsulated place where keys are accumulated and values interpreted. That way user of this object don't need to know much about its nature, they can just deal with well-know things like strings and numbers.
I'm going to go ahead and close this, but @pixelzoom and @samreid are welcome to review and re-open if they feel the need.
From CT:
Oh, it’s an example of https://github.com/phetsims/axon/issues/303 where we get a callback when the accumulated keys and string are out of sync, when the listener order is reversed.