Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Consider the following groups with conditionally rendered panels.
Versions 2 or 3
Versions 2 and 3 of this library will save group layouts to a single
localStorageentry:react-resizable-panels:group-id{ "left,right": { "expandToSizes": {}, "layout": [50, 50] }, "center,left,right": { "expandToSizes": {}, "layout": [33.3, 33.3, 33.3] } }Version 4
Version 4 will save layouts separately for each combination of panel ids (if panel ids were explicitly passed to the
useDefaultLayoutHook).react-resizable-panels:group-id:left:right{ "left": 50, "right": 50 }react-resizable-panels:group-id:left:center:right{ "left": 33.3, "center": 33.3, "right": 33.3 }react-resizable-panels:group-idSame format as above, but whichever combination was rendered most recently.
This commit updates the
useDefaultLayouthook so that it falls back to an older version 2/3 layout if a version 4 layout is not found.The logic for this is as follows:
flowchart TD START[useDefaultLayout] --> IDS{Has panel ids?} IDS -->|No| IDS_NO{Saved data?} IDS_NO -->|Yes| IDS_NO_VERSION{Which version?} IDS_NO_VERSION -->|Version 4| IDS_NO_VERSION_4[Use layout] IDS_NO_VERSION -->|Version 3| IDS_NO_VERSION_3[How many layouts?] IDS_NO_VERSION_3 -->|1 layout| IDS_NO_VERSION_3_1[Convert legacy layout] IDS_NO_VERSION_3 -->|2+ layouts| IDS_NO_VERSION_3_MORE[No default layout] IDS_NO -->|No| IDS_NO_UNDEFINED[No default layout] IDS -->|Yes| IDS_YES{Saved data?} IDS_YES -->|Yes| IDS_YES_VERSION{Which version?} IDS_YES_VERSION -->|Version 4| IDS_YES_VERSION_4[Use layout] IDS_YES_VERSION -->|Version 3| IDS_YES_VERSION_3[Convert legacy layout] IDS_YES -->|No| IDS_YES_FALLBACK[Check for legacy data]Resolves #605