summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useThemeCommand.ts
diff options
context:
space:
mode:
authorJacob Richman <[email protected]>2025-06-02 19:09:11 -0700
committerGitHub <[email protected]>2025-06-02 19:09:11 -0700
commit447826ab40354c01667328a651f6a0f239825c64 (patch)
tree75117ff082496c59301ee979e41287860c9effb7 /packages/cli/src/ui/hooks/useThemeCommand.ts
parent2ab7e3da710fabe3d5d64081ea7ed51137513085 (diff)
fix(cli): restore first-launch theme prompt (#703)
Diffstat (limited to 'packages/cli/src/ui/hooks/useThemeCommand.ts')
-rw-r--r--packages/cli/src/ui/hooks/useThemeCommand.ts19
1 files changed, 12 insertions, 7 deletions
diff --git a/packages/cli/src/ui/hooks/useThemeCommand.ts b/packages/cli/src/ui/hooks/useThemeCommand.ts
index d8b0ef6b..01911b44 100644
--- a/packages/cli/src/ui/hooks/useThemeCommand.ts
+++ b/packages/cli/src/ui/hooks/useThemeCommand.ts
@@ -26,18 +26,23 @@ export const useThemeCommand = (
const effectiveTheme = loadedSettings.merged.theme;
// Initial state: Open dialog if no theme is set in either user or workspace settings
- const [isThemeDialogOpen, setIsThemeDialogOpen] = useState(false);
+ const [isThemeDialogOpen, setIsThemeDialogOpen] = useState(
+ effectiveTheme === undefined, // Open dialog if no theme is set initially
+ );
// TODO: refactor how theme's are accessed to avoid requiring a forced render.
const [, setForceRender] = useState(0);
// Apply initial theme on component mount
useEffect(() => {
- if (!themeManager.setActiveTheme(effectiveTheme)) {
- // If theme is not found during initial load, open the theme selection dialog and set error message
- setIsThemeDialogOpen(true);
- setThemeError(`Theme "${effectiveTheme}" not found.`);
- } else {
- setThemeError(null); // Clear any previous theme error on success
+ // Only try to set a theme if one is actually defined.
+ // If effectiveTheme was undefined, the dialog is already open due to useState above.
+ if (effectiveTheme !== undefined) {
+ if (!themeManager.setActiveTheme(effectiveTheme)) {
+ setIsThemeDialogOpen(true);
+ setThemeError(`Theme "${effectiveTheme}" not found.`);
+ } else {
+ setThemeError(null); // Clear any previous theme error on success
+ }
}
}, [effectiveTheme, setThemeError]); // Re-run if effectiveTheme or setThemeError changes