diff options
| author | Allen Hutchison <[email protected]> | 2025-05-06 14:48:49 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-06 14:48:49 -0700 |
| commit | adeda6a5b35faddacc4c4b251fbc8f809a4a2758 (patch) | |
| tree | 45a90e9bb45ea1cb2d07b99aea5b2725acdb88b9 /packages/cli/src/ui/hooks/useThemeCommand.ts | |
| parent | e26c436d5cfd44948064fcd6be4a46a9ef1a7655 (diff) | |
Refactor: Memoize hook callbacks, update dependencies, and fix lint errors (#268)
Co-authored-by: N. Taylor Mullen <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useThemeCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useThemeCommand.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/useThemeCommand.ts b/packages/cli/src/ui/hooks/useThemeCommand.ts index 542ee062..0f4ab93b 100644 --- a/packages/cli/src/ui/hooks/useThemeCommand.ts +++ b/packages/cli/src/ui/hooks/useThemeCommand.ts @@ -35,14 +35,14 @@ export const useThemeCommand = ( setIsThemeDialogOpen(true); }, []); - function applyTheme(themeName: string | undefined) { + const applyTheme = useCallback((themeName: string | undefined) => { try { themeManager.setActiveTheme(themeName); setForceRender((v) => v + 1); // Trigger potential re-render } catch (error) { console.error(`Error setting theme: ${error}`); } - } + }, []); const handleThemeHighlight = useCallback( (themeName: string | undefined) => { @@ -61,7 +61,7 @@ export const useThemeCommand = ( setIsThemeDialogOpen(false); // Close the dialog } }, - [applyTheme], // Added applyTheme to dependencies + [applyTheme, loadedSettings], ); return { |
