Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
[:bug:] fixed an issue that caused problem with persisted states
Browse files Browse the repository at this point in the history
  • Loading branch information
Mostafa Shamsitabar committed Apr 3, 2021
1 parent fa709b4 commit 9cd209d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/sonnat-ui/src/styles/useDarkMode/useDarkMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import usePreviousValue from "../../utils/usePreviousValue";
import defaultTheme from "../defaultTheme";

export default function useDarkMode(isDarkMode = false, theme = defaultTheme) {
const prevState = usePreviousValue(isDarkMode);
const cachedTheme = React.useRef(theme);
const prevState = usePreviousValue(isDarkMode);

const newTheme = React.useMemo(() => {
if (prevState != null && isDarkMode !== prevState) {
if (isDarkMode !== prevState) {
return {
...cachedTheme.current,
colors: {
Expand Down

0 comments on commit 9cd209d

Please sign in to comment.