Externalize selected value in redux to avoid selected state switch#1384
Open
abcampo-iry wants to merge 2 commits intomainfrom
Open
Externalize selected value in redux to avoid selected state switch#1384abcampo-iry wants to merge 2 commits intomainfrom
abcampo-iry wants to merge 2 commits intomainfrom
Conversation
- This we way avoid that when it changes between mobile and desktop it looses previous state
Contributor
There was a problem hiding this comment.
Pull request overview
This PR externalizes the currently selected sidebar panel into Redux so the user’s sidebar selection is preserved when switching between desktop and mobile layouts (e.g., across responsive breakpoints).
Changes:
- Add
selectedSidebarOptionandsetSidebarOptiontoEditorSlice. - Update
Sidebarto initialize/persist the selected panel via Redux instead of purely local state. - Add a regression test to ensure the selected sidebar panel remains active after resizing across the mobile breakpoint.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/redux/EditorSlice.js | Adds Redux state + action to persist selected sidebar option. |
| src/components/Menus/Sidebar/Sidebar.jsx | Reads/writes selected option from Redux and adjusts default/validation logic. |
| src/components/WebComponentProject/WebComponentProject.test.js | Adds breakpoint-resize regression test; introduces a “real store” render helper. |
| src/components/Mobile/MobileProject/MobileProject.test.js | Removes some sidebar rendering tests (likely superseded by the new integration-style resize test). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1aee796 to
51a282b
Compare
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.
This we way avoid that when it changes between mobile and desktop it looses previous state.
The PR moves the "memory" of which sidebar tab is selected into the global Redux store.
optionIsAvailableto ensure that if the sidebar tries to open a tab that doesn't exist in the current context, it reverts to a default.Screen.Recording.2026-03-16.at.13.00.25.mov
Adds also test to cover this.