Repository navigation
fix(splitter): keep the layout when the root resizes along the cross axis - #3545
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: 55e44da The changes in this PR will be included in the next version bump. This PR includes changesets to release 85 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4 tasks
This branch was successfully 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.
Fixes chakra-ui/ark#4228.
Problem
In a nested splitter, dragging the outer splitter snaps the inner splitter back to its default layout. Dragging where the two resize triggers meet makes the inner panels flicker between the pointer position and the default.
syncSizeruns on everyROOT.RESIZE, and the ResizeObserver watches the whole border box. When the root changes size along the cross axis only (width, for a vertical splitter), the group size is unchanged, socanPreserveLayoutis false and the code falls back to the resolvedsize ?? defaultSize, discarding the current layout.Fix
When the group size is unchanged and the panels,
size, anddefaultSizeprops are the same as the last sync, keep the current layout. Prop changes still resolve from the props, so controlledsizeupdates are unaffected. The props key is tracked in a ref rather than by checking the event type, becausesyncSizealso runs fromwatch, where the event is whatever the machine received last.Verification
/splitter/nested: resize the inner splitter, then drag the outer one. It fails without the fix (42→33) and passes with it.50.6 → 50 → 51.9 → 50 → 53.1…; with the fix it moves steadily63.2 → 72.