Skip to content

Commit

Permalink
v0.28 - fix system mode not toggling off when switching to same mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayvignesh01 committed Apr 29, 2024
1 parent 04f3638 commit a76bd47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-infinite-themes",
"version": "0.0.27",
"version": "0.0.28",
"description": "Simple theme switcher for Next.js that supports the basic light/dark/system mode along with an infinite number of color themes for each.",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
6 changes: 2 additions & 4 deletions src/create-theme-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ export const createThemeStore = (props: ThemeProviderProps) => {

mode: undefined, // initialized by dangerouslySetInnerHTML
setMode: (mode) => {
// if system is true, disable it if switching to non system preference theme
// if system is true, disable it
const system = get().system;
if (system) {
if (mode !== getSystemTheme()) {
set(() => ({ system: false }));
}
set(() => ({ system: false }));
}

setDocumentTheme({
Expand Down

0 comments on commit a76bd47

Please sign in to comment.