Avoid throwing when purging (#4489)

* Avoid throwing when purging

* Update app/store/index.ts

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
This commit is contained in:
Elias Nahum 2020-06-26 16:14:03 -04:00 committed by GitHub
parent 56c593d36c
commit cfbb7d4d55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,7 +187,9 @@ export default function configureStore(storage: any, preloadedState: any = {}, o
const rootReducer: any = (state: GlobalState, action: GenericAction) => {
if (action.type === General.OFFLINE_STORE_PURGE) {
// eslint-disable-next-line no-underscore-dangle
delete action.data._persist;
if (action.data?._persist) {
delete action?.data?._persist;
}
return baseReducer(action.data, action as any);
}
return baseReducer(state as any, action as any);
@ -230,7 +232,7 @@ export default function configureStore(storage: any, preloadedState: any = {}, o
store.dispatch({
type: General.OFFLINE_STORE_PURGE,
state,
data: state,
});
console.log('HYDRATED FROM v4', storeKeys); // eslint-disable-line no-console