-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: Handle mode selector empty state on workspace switch #9674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When switching between VS Code workspaces, if the current mode from workspace A is not available in workspace B, the mode selector would show an empty string. This fix adds fallback logic to automatically switch to the default "code" mode when the current mode is not found in the available modes list. Changes: - Import defaultModeSlug from @roo/modes - Add fallback logic in selectedMode useMemo to detect when current mode is not available and automatically switch to default mode - Add tests to verify the fallback behavior works correctly - Export defaultModeSlug in test mock for consistent behavior
Re-reviewed after new commits. All previously flagged issues have been resolved. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
|
@roomote address the feedback |
Fixed the reported issue. All local checks passed. |
Fixed the infinite loop issue by adding a ref to track notified invalid modes and removing |
Re-reviewed after new commits. All previously flagged issues have been resolved. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Closes #10660
Summary
Fixes a bug where the mode selector would show an empty string when switching between VS Code workspaces if the current mode from workspace A is not available in workspace B.
Changes
defaultModeSlugfrom@roo/modesselectedModeuseMemo to detect when the current mode is not available and automatically switch to the default "code" modedefaultModeSlugin test mock for consistent behaviorTesting
ModeSelector.spec.tsx:Behavior
When the mode selector detects that the current mode is not in the list of available modes (e.g., after switching workspaces), it will:
View task on Roo Code Cloud
Important
Fixes
ModeSelectorto fallback to default mode when current mode is unavailable, preventing empty string display.ModeSelectornow falls back todefaultModeSlugwhen the current mode is unavailable, displaying "code" instead of an empty string.defaultModeSlugfrom@roo/modesinModeSelector.tsx.selectedModeuseMemoanduseEffectto handle unavailable modes.ModeSelector.spec.tsxto verify fallback to default mode and correct display of mode name.onChangeis called with default mode when current mode is unavailable.This description was created by
for d10e3bc. You can customize this summary. It will automatically update as commits are pushed.