From 4cc71790d7cc594f577a0751835b7a7daf96a582 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Tue, 27 Sep 2022 05:37:42 +0200 Subject: [PATCH] dev --- src/app/components/Persist/Lock.tsx | 13 +++++++++++++ src/app/state/persist/saga.ts | 1 + src/store/configureStore.ts | 2 ++ src/store/reducers.ts | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/src/app/components/Persist/Lock.tsx b/src/app/components/Persist/Lock.tsx index 6b8162e90d..5b0733df4a 100644 --- a/src/app/components/Persist/Lock.tsx +++ b/src/app/components/Persist/Lock.tsx @@ -1,3 +1,4 @@ +import { fatalErrorActions } from 'app/state/fatalerror' import { persistActions } from 'app/state/persist' import { selectIsPersisted } from 'app/state/persist/selectors' import { Box, Button } from 'grommet' @@ -17,6 +18,18 @@ export function Lock() { + ) } diff --git a/src/app/state/persist/saga.ts b/src/app/state/persist/saga.ts index 02703de80b..b1ba76822e 100644 --- a/src/app/state/persist/saga.ts +++ b/src/app/state/persist/saga.ts @@ -30,6 +30,7 @@ function* watchPersistAsync() { } function* handleAsyncPersistActions(action: AnyAction) { + console.log('handleAsyncPersistActions: action of type', action.type) if (persistActions.setPasswordAsync.match(action)) { yield* call(setPasswordAsync, action) } else if (persistActions.unlockAsync.match(action)) { diff --git a/src/store/configureStore.ts b/src/store/configureStore.ts index 24f617453a..036098ecaa 100644 --- a/src/store/configureStore.ts +++ b/src/store/configureStore.ts @@ -9,6 +9,8 @@ import { configureStoreWithSyncTabs } from 'app/state/persist/syncTabs' export function configureAppStore(state?: Partial) { const sagaMiddleware = createSagaMiddleware({ onError: (error, info) => { + console.error(error) + console.error(info.sagaStack) store.dispatch( fatalErrorActions.setError({ message: error.toString(), diff --git a/src/store/reducers.ts b/src/store/reducers.ts index ba38a26a4b..2c818130bc 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -32,9 +32,14 @@ function createRootReducer() { return rootReducer } +window.addEventListener('storage', event => { + console.log('a different tab wrote to localStorage', event) +}) + export function createPersistedRootReducer() { const originalRootReducer = createRootReducer() return (state: RootState | undefined, action: AnyAction): RootState => { + console.log('PersistedRootReducer: action of type', action.type, action.$isSync ? '$isSync=true' : '') const newState = originalRootReducer(state, action) if (persistActions.setUnlockedRootState.match(action)) { return receivePersistedRootState(