fix: react infinite depth error

This commit is contained in:
Prayag Prajapati committed 2024-09-29 00:02:47 +05:30
1 parent d78676560f
commit a1bb8f8e23
19 files changed
+377 -370

No files matched your search

+9 -4
View File
@@ -1,9 +1,14 @@
import { create } from "zustand";
import { shallow } from "zustand/shallow";
import { createWithEqualityFn } from "zustand/traditional";
const useSettingsStore = create(() => ({
dialogOpen: false,
tabValue: 0,
}));
const useSettingsStore = createWithEqualityFn(
() => ({
dialogOpen: false,
tabValue: 0,
}),
shallow,
);
const setDialogOpen = (dialog: boolean) =>
useSettingsStore.setState((state) => ({ ...state, dialogOpen: dialog }));