fix(ui): escaping theme dialog no longer resets theme to default (#11323)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Pyush Sinha
2025-10-20 10:50:09 -07:00
committed by GitHub
parent d0ab6e9982
commit 397e52dac7
6 changed files with 51 additions and 14 deletions
@@ -20,7 +20,10 @@ import { ScopeSelector } from './shared/ScopeSelector.js';
interface ThemeDialogProps {
/** Callback function when a theme is selected */
onSelect: (themeName: string | undefined, scope: SettingScope) => void;
onSelect: (themeName: string, scope: SettingScope) => void;
/** Callback function when the dialog is cancelled */
onCancel: () => void;
/** Callback function when a theme is highlighted */
onHighlight: (themeName: string | undefined) => void;
@@ -32,6 +35,7 @@ interface ThemeDialogProps {
export function ThemeDialog({
onSelect,
onCancel,
onHighlight,
settings,
availableTerminalHeight,
@@ -42,9 +46,9 @@ export function ThemeDialog({
);
// Track the currently highlighted theme name
const [highlightedThemeName, setHighlightedThemeName] = useState<
string | undefined
>(settings.merged.ui?.theme || DEFAULT_THEME.name);
const [highlightedThemeName, setHighlightedThemeName] = useState<string>(
settings.merged.ui?.theme || DEFAULT_THEME.name,
);
// Generate theme items filtered by selected scope
const customThemes =
@@ -112,7 +116,7 @@ export function ThemeDialog({
setMode((prev) => (prev === 'theme' ? 'scope' : 'theme'));
}
if (key.name === 'escape') {
onSelect(undefined, selectedScope);
onCancel();
}
},
{ isActive: true },