Function: createPersistConfig()
createPersistConfig<
T>(name:string,partialize?: (state:T) =>Partial<T>): {name:string;partialize: (state:T) =>Partial<T> |undefined; }
Defined in: src/stores/utils.ts:88
Creates a persistence configuration for Zustand store persistence.
Type Parametersโ
Tโ
T
Parametersโ
nameโ
string
Unique name for the persisted store data
partialize?โ
(state: T) => Partial<T>
Optional function to select which parts of state to persist
Returnsโ
Configuration object for zustand/middleware/persist
nameโ
name:
string
Prefixed store name for persistence
partializeโ
partialize: (
state:T) =>Partial<T> |undefined
Function to select which parts of state to persist
Remarksโ
This utility creates a standardized persistence configuration that prefixes all store names with 'uptime-watcher-' to avoid conflicts with other applications. The partialize function allows selective persistence of store properties.
Exampleโ
const useMyStore = create(
    persist((set, get) => ({}), createPersistConfig("my-store"))
);