Skip to content

Commit

Permalink
dev: logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Sep 19, 2022
1 parent 4e5207e commit 22369e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/state/persist/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 2 additions & 0 deletions src/store/configureStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { configureStoreWithSyncTabs } from 'app/state/persist/syncTabs'
export function configureAppStore(state?: Partial<RootState>) {
const sagaMiddleware = createSagaMiddleware({
onError: (error, info) => {
console.error(error)
console.error(info.sagaStack)
store.dispatch(
fatalErrorActions.setError({
message: error.toString(),
Expand Down
5 changes: 5 additions & 0 deletions src/store/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
if (persistActions.setUnlockedRootState.match(action)) {
const newState = action.payload.rootState
return newState
Expand Down

0 comments on commit 22369e0

Please sign in to comment.