Roo-Code/webview-ui/src/components/chat/__tests__
roomote[bot] 5bd26eb1d9
fix: Handle mode selector empty state on workspace switch (#9674)
* fix: handle mode selector empty state on workspace switch

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

* fix: prevent infinite loop by moving fallback notification to useEffect

* fix: prevent infinite loop by using ref to track notified invalid mode

* refactor: clean up comments in ModeSelector fallback logic

---------

Co-authored-by: Roo Code <roomote@roocode.com>
Co-authored-by: daniel-lxs <ricciodaniel98@gmail.com>
2026-01-21 20:47:51 -05:00
..
ApiConfigSelector.spec.tsx fix: keep pinned models fixed at top of scrollable list (#8813) 2025-11-04 22:01:06 -05:00
BatchFilePermission.spec.tsx fix: standardize tooltip delays to 300ms (#5090) (#5098) 2025-06-26 15:41:32 -04:00
BrowserSessionRow.aspect-ratio.spec.tsx Browser Use 2.0 (#8941) 2025-11-21 17:26:15 -05:00
BrowserSessionRow.disconnect-button.spec.tsx Browser Use 2.0 (#8941) 2025-11-21 17:26:15 -05:00
BrowserSessionRow.spec.tsx Browser Use 2.0 (#8941) 2025-11-21 17:26:15 -05:00
ChatRow.diff-actions.spec.tsx feat(chat): Improve diff appearance in main chat view (#8932) 2025-11-06 16:18:01 -05:00
ChatRow.rate-limit-wait.spec.tsx Fix rate limit wait display (#10389) 2025-12-30 21:56:32 -08:00
ChatRow.run-slash-command.spec.tsx feat: add run_slash_command tool for executing slash commands (#7473) 2025-09-03 14:14:55 -04:00
ChatTextArea.spec.tsx feat: add toggle for Enter key behavior in chat input (#10002) 2025-12-10 20:31:43 -08:00
ChatView.keyboard-fix.spec.tsx Random chat text area cleanup (#7436) 2025-08-26 20:48:24 -07:00
ChatView.notification-sound.spec.tsx fix: prevent notification sound on attempt_completion with queued messages (#8540) 2025-11-06 16:44:52 -05:00
ChatView.spec.tsx Refactor: Unified context-management architecture with improved UX (#9795) 2025-12-07 17:43:48 -05:00
CheckpointRestoreDialog.spec.tsx Edit/Delete User Message (#7447) 2025-09-05 14:50:18 -04:00
CloudTaskButton.spec.tsx feat: Add cloud task button for opening tasks in Roo Code Cloud (#7572) 2025-09-11 15:08:14 -04:00
CodeIndexPopover.auto-populate.spec.tsx Feature/bedrock embeddings support (#9475) 2025-11-26 08:58:58 -05:00
CommandExecution.spec.tsx Batch settings updates from the webview to the extension host (#9165) 2025-11-12 12:29:06 -08:00
CommandPatternSelector.spec.tsx ux: Redesigned Message Feed (#7985) 2025-09-19 09:30:13 -04:00
ErrorRow.spec.tsx ux: add downloadable error diagnostics from chat errors (#10188) 2025-12-19 11:50:40 -08:00
FollowUpSuggest.spec.tsx fix: cancel auto-approval timeout when user starts typing (#9937) 2025-12-12 10:25:14 -05:00
IndexingStatusBadge.spec.tsx Random chat text area cleanup (#7436) 2025-08-26 20:48:24 -07:00
ModeSelector.spec.tsx fix: Handle mode selector empty state on workspace switch (#9674) 2026-01-21 20:47:51 -05:00
OpenMarkdownPreviewButton.spec.tsx feat: add button to open markdown in VSCode preview (#10773) 2026-01-16 10:56:19 -05:00
ShareButton.spec.tsx Add config to control public sharing (#10105) 2025-12-15 21:58:15 -05:00
SlashCommandItemSimple.spec.tsx Move more types to @roo-code/types (for the cli) (#10583) 2026-01-09 11:59:06 -08:00
TaskActions.spec.tsx Add config to control public sharing (#10105) 2025-12-15 21:58:15 -05:00
TaskHeader.spec.tsx Revert "feat: Experiment: Show a bit of stats in Cloud tab to help users discover there's more in Cloud" (#8559) 2025-10-07 21:37:10 -04:00
TooManyToolsWarning.spec.tsx feat: warn users when too many MCP tools are enabled (#10772) 2026-01-18 09:22:09 -05:00
WarningRow.spec.tsx feat: warn users when too many MCP tools are enabled (#10772) 2026-01-18 09:22:09 -05:00