Open naresh1021 opened 2 years ago
I had persistence applied to some (2) states in my slice and later remove one state from being persisted.
const persistedKeys = ['state1', 'state2']; const persistConfig = { key: 'sample', storage: storage, whitelist: persistedKeys, }; const sampleReducers = persistReducer(persistConfig, sampleSlice.reducer);
The persisted value was written correctly to the localstorage.
localstorage
{state1: "false", state2: "false", _persist: "{"version":-1,"rehydrated":true}"} state1: "false" state2: "false" _persist: "{\"version\":-1,\"rehydrated\":true}"
Later, I removed persistence for one of the states and that entry was removed from the localstorage.
Code: const persistedKeys = ['state1']; Localstorage: {state1: "false", _persist: "{"version":-1,"rehydrated":true}"} state1: "false" _persist: "{\"version\":-1,\"rehydrated\":true}"
Now if I remove the persistence for the last state, the entry for that state is removed from the localstorage but the localstorage now has an empty entry like below.
Code: const persistedKeys = ['']; Localstorage: {_persist: "{"version":-1,"rehydrated":true}"} _persist: "{\"version\":-1,\"rehydrated\":true}"
I even tried removing the persistReducer applied on the slice's reducer but the empty entry in localstorage still remains.
const sampleReducers = sampleSlice.reducer;
Is it possible to clear this entry as well? Am I missing something?
I had persistence applied to some (2) states in my slice and later remove one state from being persisted.
The persisted value was written correctly to the
localstorage
.Later, I removed persistence for one of the states and that entry was removed from the
localstorage
.Now if I remove the persistence for the last state, the entry for that state is removed from the localstorage but the localstorage now has an empty entry like below.
I even tried removing the persistReducer applied on the slice's reducer but the empty entry in localstorage still remains.
Is it possible to clear this entry as well? Am I missing something?