auth: persist the state only if changed
This commit is contained in:
parent
fa4d36b7a7
commit
ad3362e3cd
|
@ -162,10 +162,12 @@ export default function auth(oldState = initialState, action) {
|
||||||
const state = reducer(oldState, action);
|
const state = reducer(oldState, action);
|
||||||
|
|
||||||
// Persist the state in localStorage
|
// Persist the state in localStorage
|
||||||
|
if (!state.equals(oldState)) {
|
||||||
localStorage.setItem('soapbox:auth', JSON.stringify(state.toJS()));
|
localStorage.setItem('soapbox:auth', JSON.stringify(state.toJS()));
|
||||||
|
|
||||||
// Reload the page under some conditions
|
// Reload the page under some conditions
|
||||||
maybeReload(oldState, state, action);
|
maybeReload(oldState, state, action);
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue