mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
Refactor: Memoize hook callbacks, update dependencies, and fix lint errors (#268)
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
parent
e26c436d5c
commit
adeda6a5b3
4 changed files with 54 additions and 41 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue