Repository navigation
fix(core): ignore stale async prop loads before releasing the current value - #10828
Conversation
[Medium impact] This PR appears safe to merge; no blocking issue was found. Summary
|
chrisgervang
left a comment
There was a problem hiding this comment.
Thanks, this looks right. Skipping _postProcessValue for a stale result stops the prop type's release from destroying the value that's actually in use. I ran the new test locally: it fails without the fix and passes with it.
One behavior change to call out: a stale data load no longer calls onDataLoad. I think that's correct, since that data never gets applied, but please mention it in the description.
|
Thanks for testing it! Good point, I added a "Behavior change" section to the description noting that a stale |
|
Released in deck.gl 9.4.2. Thanks @SahinurDEV! |
Closes #10827
Background
When an async prop changes while an earlier load is still pending and the loads resolve out of order,
ComponentState._watchPromiseruns_postProcessValueon the stale result before_setAsyncPropValuerejects it by load count. That calls the prop type'sreleasehook on the currently active value (e.g. destroys the activeIconLayer.iconAtlastexture) and transforms a value that is then thrown away.Change List
ComponentState: discard stale promise results before post processingyarn lintandvitest --project headless test/modules/core test/modules/layers)Behavior change
_onResolve, so a staledataload no longer callsonDataLoad. That data is never applied, so the callback only fires for the load that actually wins.Note
Medium Risk
Touches core async prop lifecycle and resource release timing; behavior change is narrowly scoped to discarding stale loads but affects all components using async props with
release/transform.Overview
Fixes a race when the same async prop is loaded multiple times and promises resolve out of order. Previously, a slower (stale) resolution still ran
_postProcessValuebefore_setAsyncPropValuedropped it, so the prop type’sreleasehook could tear down the currently active resolved value (e.g. an icon atlas texture) even though that result was never applied.ComponentState._watchPromisenow bails out whenloadCount < resolvedLoadCountbefore post-processing, so stale completions skiprelease/transformentirely. A new unit test covers the out-of-order case: newer value wins, stale completion does not change state, release, or transform.Reviewed by Cursor Bugbot for commit 4bba4c4. Bugbot is set up for automated code reviews on this repo. Configure here.