rt2zz / redux-persist-crosstab

Keep redux browser tab state in sync
85 stars 27 forks source link

Issue using with redux-persist on REHYDRATE action type. #20

Open yugantar7 opened 5 years ago

yugantar7 commented 5 years ago

I am using both redux-persist and redux-persist-crosstab and the reducers return the Initial State of the application when action type is REHYDRATE for handling the corrupt state.

const reducer1 = (state=INITIAL_STATE.reducer1, action) => {
        case REHYDRATE:
            return INITIAL_STATE;

        default:
            return state;
    }
}

Now crosstab overlaps with it because even crosstab uses REHYDRATE action - So, whenever I open a new tab, the initial state is returned and not the updated state from other tabs. persistor.rehydrate(statePartial, {serial: true})

What to do in such a case?