Automated cherry pick of #4489 (#4492)

* Avoid throwing when purging

* Update app/store/index.ts

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

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
This commit is contained in:
Mattermost Build 2020-06-26 22:20:17 +02:00 committed by GitHub
parent 793ac98d74
commit da440e50fb
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