Skip to content

Commit 7c42ff0

Browse files
v1.4.0-alpha.4 | fix: first initialize colors
1 parent 3715582 commit 7c42ff0

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

package-lock.json

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shadcn-theme-editor",
3-
"version": "1.4.0-alpha.2",
3+
"version": "1.4.0-alpha.4",
44
"description": "Shadcn Theme Editor",
55
"module": "dist/index.mjs",
66
"main": "dist/index.js",

src/components/SideBarColors.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,16 @@ function SideBarColors() {
2525
}, 2000);
2626

2727
useEffect(() => {
28-
let isSavedThemeApplied = false;
2928
if (typeof colors == "undefined" || isMount) {
3029
// If colors are not defined (i.e., they haven't been set by other functions yet, meaning it's the first time),
3130
// or if this is due to a re-render caused by dependency changes (e.g., when currentTheme is updated).
32-
try {
33-
isSavedThemeApplied = setSavedTheme(currentTheme);
34-
return;
35-
} catch (error) {}
31+
if (setSavedTheme(currentTheme)) return; // isSavedThemeApplied
3632
}
3733

3834
if (typeof colors == "undefined") {
3935
themeEmittor.setDefaultTheme();
4036
}
41-
}, [currentTheme]);
37+
}, [currentTheme, isMount]);
4238

4339
return (
4440
<>

0 commit comments

Comments
 (0)