mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-26 01:44:53 +10:00
chore: remove react-doctor from package scripts and update task dependencies in turbo.json
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { StateStorage } from "zustand/middleware";
|
||||
import type { SidebarSection } from "@/libs/resume/section";
|
||||
import { createJSONStorage, persist } from "zustand/middleware";
|
||||
import { immer } from "zustand/middleware/immer";
|
||||
@@ -20,6 +21,18 @@ type SectionStoreActions = {
|
||||
|
||||
type SectionStore = SectionStoreState & SectionStoreActions;
|
||||
|
||||
const noopStorage: StateStorage = {
|
||||
getItem: () => null,
|
||||
removeItem: () => {},
|
||||
setItem: () => {},
|
||||
};
|
||||
|
||||
const getSectionStoreStorage = () => {
|
||||
if (typeof window === "undefined") return noopStorage;
|
||||
|
||||
return window.localStorage ?? noopStorage;
|
||||
};
|
||||
|
||||
export const useSectionStore = create<SectionStore>()(
|
||||
persist(
|
||||
immer((set) => ({
|
||||
@@ -46,7 +59,7 @@ export const useSectionStore = create<SectionStore>()(
|
||||
})),
|
||||
{
|
||||
name: "section-store",
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
storage: createJSONStorage(getSectionStoreStorage),
|
||||
partialize: (state) => ({
|
||||
sections: state.sections,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user