BREAKING CHANGE - Flux Stores can call dispose with awaitAnimationFrame: true and protect everyone from batched redraw collisions. 🚓#31
Conversation
…ct everyone from batched redraw collisions. 🚓
RavenNumber of Findings: 0 |
|
Maybe add a new method called |
|
I wanted to do this in w_flux, but the store doesn't know about all the internal disposables. So, if you had 100 nested stores, you would wind up waiting 1700ms if you awaited that top-level store.dispose call. 😭 |
|
Why is this a breaking change? |
|
@maxwellpeterson-wf you can't really enforce whether consumers utilize the interface via Would be nice if there was an annotation or something like that - that would allow us to prevent certain classes from being "implemented" by consumers.... |
|
@aaronlademann-wf I've got a spike of just such an annotation but I haven't had time to clean it up and PR it. @maxwellpeterson-wf because the |
|
@maxwellpeterson-wf It's a breaking change, because anyone that has extended it, without the named optional parameter will get this: |
|
We will try it like this. Workiva/over_react#72 |



Description
Calling dispose on a flux store before its components' batched redraws have finished can cause that pending redraw to attempt to subscribe to a disposed store's onData stream. Exceptions abound. All consumers shouldn't have to know and worry about it.
Changes
Allow disposable to optionally wait for the length of an animation frame.
w_flux Store class would call dispose with awaitAnimationFrame: true. So, the first store to dispose would wait for 17ms, but all internal stores that are looped through would not wait.
Semantic Versioning
Testing/QA
Code Review
@georgelesica-wf
@dustinlessard-wf
@evanweible-wf
@jayudey-wf
@maxwellpeterson-wf
@sebastianmalysa-wf
@trentgrover-wf