Skip to content

Commit

Permalink
fix(plugin): prevent infinite loop on watch (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac authored May 10, 2022
1 parent 63d86ab commit d4ee818
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/plugin.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default defineNuxtPlugin((nuxtApp) => {

function watchStorageChange () {
window.addEventListener('storage', (e) => {
if (e.key === storageKey) {
if (e.key === storageKey && e.newValue && colorMode.preference !== e.newValue) {
colorMode.preference = e.newValue
}
})
Expand Down

0 comments on commit d4ee818

Please sign in to comment.