From cfbb7d4d555a4e0cd90ff322a1e201604ea76262 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 26 Jun 2020 16:14:03 -0400 Subject: [PATCH] Avoid throwing when purging (#4489) * Avoid throwing when purging * Update app/store/index.ts Co-authored-by: Miguel Alatzar Co-authored-by: Miguel Alatzar --- app/store/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/store/index.ts b/app/store/index.ts index 07524a0af..afc4c25d0 100644 --- a/app/store/index.ts +++ b/app/store/index.ts @@ -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