Repository navigation
gpui: fix stale cached layout nodes after element path changes - #52
Merged
Merged
Conversation
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.
A clean cached view can reuse paint after an anonymous wrapper is added or removed, but its retained record still copied the previous layout root. Once that node was released, a subsequent child notification made
layout_reachespanic withinvalid SlotMap key used, as reported in longbridge/gpui-kit#3408 (comment).Refresh the reused view record with the layout requested this frame and its current rebuild context. Paint remains cached, while future splices use the current layout node and element path.
Regression tests cover adding, removing, and keeping the wrapper, followed by repeated child updates. They verify cached paint reuse, consistent rebuild paths, and frame output matching retention disabled. Before the fix, both shape-change scenarios reproduce the SlotMap panic.
Validation:
cargo test -p gpui --lib fast::tests:: -- --nocapture: 233 passed, 1 ignored.cargo clippy -p gpui --lib --tests -- -D warnings: passed.script/check-upstream: passed.git diff --check: passed.