Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 28, 2025

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

  • Import defaultModeSlug from @roo/modes
  • Add fallback logic in selectedMode useMemo to detect when the current mode is not available and automatically switch to the default "code" mode
  • Add tests to verify the fallback behavior works correctly
  • Export defaultModeSlug in test mock for consistent behavior

Testing

  • Added two new tests in ModeSelector.spec.tsx:
    1. Verifies that onChange is called with the default mode when current mode is not available
    2. Verifies that the default mode name is displayed instead of an empty string
  • All existing tests continue to pass

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:

  1. Automatically switch to the default "code" mode
  2. Display the mode name instead of an empty string
  3. Notify the parent component to update the mode state

View task on Roo Code Cloud


Important

Fixes ModeSelector to fallback to default mode when current mode is unavailable, preventing empty string display.

  • Behavior:
    • ModeSelector now falls back to defaultModeSlug when the current mode is unavailable, displaying "code" instead of an empty string.
    • Notifies parent component to update mode state when fallback occurs.
  • Code Changes:
    • Import defaultModeSlug from @roo/modes in ModeSelector.tsx.
    • Add fallback logic in selectedMode useMemo and useEffect to handle unavailable modes.
  • Testing:
    • Add tests in ModeSelector.spec.tsx to verify fallback to default mode and correct display of mode name.
    • Ensure onChange is called with default mode when current mode is unavailable.

This description was created by Ellipsis for d10e3bc. You can customize this summary. It will automatically update as commits are pushed.

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
@roomote
Copy link
Contributor Author

roomote bot commented Nov 28, 2025

Rooviewer Clock   See task on Roo Cloud

Re-reviewed after new commits. All previously flagged issues have been resolved.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 28, 2025
@brunobergher
Copy link
Collaborator

@roomote address the feedback

@roomote
Copy link
Contributor Author

roomote bot commented Nov 28, 2025

Fixaroo Clock   See task on Roo Cloud

Fixed the reported issue. All local checks passed.

View commit | Revert commit

@roomote
Copy link
Contributor Author

roomote bot commented Nov 28, 2025

Fixaroo Clock   See task on Roo Cloud

Fixed the infinite loop issue by adding a ref to track notified invalid modes and removing onChange from the useEffect dependencies. All local checks passed.

View commit | Revert commit

@brunobergher brunobergher marked this pull request as ready for review November 28, 2025 17:05
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Nov 28, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 28, 2025

Rooviewer Clock   See task on Roo Cloud

Re-reviewed after new commits. All previously flagged issues have been resolved.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Nov 28, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 28, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 21, 2026
@mrubens mrubens merged commit 5bd26eb into main Jan 22, 2026
13 checks passed
@mrubens mrubens deleted the fix/mode-selector-workspace-switch branch January 22, 2026 01:47
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jan 22, 2026
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Mode selector shows empty state on workspace switch

5 participants