Skip to content
Myr

fix(persist): use window.localStorage as default storage reference (#3367)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jewook Yoo / Mason · committed by GitHub · parent 267a57c · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/middleware/persist.ts+2 added-2 removed
71 unmodified lines
72 *73 * Combining `createJSONStorage` helps creating a persist storage74 * with JSON.parse and JSON.stringify.75 *76 * @default createJSONStorage(() => localStorage)76 * @default createJSONStorage(() => window.localStorage)77 */78 storage?: PersistStorage<PersistedState, PersistReturn> | undefined79 /**80 * Filter the persisted value.
105 unmodified lines
186187const persistImpl: PersistImpl = (config, baseOptions) => (set, get, api) => {188 type S = ReturnType<typeof config>189 let options = {190 storage: createJSONStorage<S, void>(() => localStorage),190 storage: createJSONStorage<S, void>(() => window.localStorage),191 partialize: (state: S) => state,192 version: 0,193 merge: (persistedState: unknown, currentState: S) => ({194 ...currentState,
213 unmodified lines