fix(spx-gui): fix stage defaulting to widget tab when switching to stage#2961
Merged
fix(spx-gui): fix stage defaulting to widget tab when switching to stage#2961
Conversation
Remove the watcher in StageEditorState that automatically switched to the widgets tab when a widget was selected. This watcher caused the stage to always display the widget tab when switching to the stage, because WidgetsEditorState initializes with the first widget pre-selected. Now the stage correctly defaults to the code tab when first activated. The widgets tab is only shown when the user explicitly navigates to it or when state is restored from the route. Fixes #2960 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>
Contributor
Author
|
Clean, well-scoped fix. The removed watcher was the sole cause of the bug — all intentional widget-selection paths ( |
cn0809
approved these changes
Mar 17, 2026
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.
Requested by @nighca
Fixes #2960
Summary
StageEditorStatethat automatically switched to the widgets tab whenever a widget was selectedWidgetsEditorStateinitializes with the first widget pre-selected, which caused the watcher to trigger and switch to the widgets tab as soon as the stage was activatedRoot Cause
In
StageEditor.vue,StageEditorStatehad a watcher onwidgetsState.selected:WidgetsEditorStateinitializesselectedIdRefwith the first widget's ID fromgetStage().widgets[0]?.id. When the project loads and widgets become available, this triggers the watcher chain:WidgetsEditorStateauto-selects the first widgetStageEditorStatesees a non-null widget and switches to'widgets'tabFix
Removed the problematic watcher. The widgets tab is now only shown when:
select('widgets'))selectWidget())selectByRoute()This preserves the "restore prior selection" behavior described in the issue while fixing the incorrect default.