Repository navigation
fix(core): ignore stale async prop loads before releasing the current value - #10828
Open
SahinurDEV wants to merge 1 commit into
Open
SahinurDEV wants to merge 1 commit into
SahinurDEV wants to merge 1 commit into
Conversation
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)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.