Skip to content

Commit

Permalink
persistState: Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Oct 8, 2020
1 parent c373c02 commit 3e25e7e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/store/plugins/persistState.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const resetState = () => {

export default (reducerLoad, reducerSave) => (store) => {
let resetting = false;
let lastEmitedState = reducerLoad(getState(), store);
store.commit('syncState', lastEmitedState);
let lastEmittedState = reducerLoad(getState(), store);
store.commit('syncState', lastEmittedState);

store.subscribe(({ type, payload }, state) => {
if (resetting || (type === 'syncState' && payload === lastEmitedState)) return;
if (resetting || (type === 'syncState' && payload === lastEmittedState)) return;
setState(reducerSave(state));
});

Expand All @@ -51,7 +51,7 @@ export default (reducerLoad, reducerSave) => (store) => {
});

window.addEventListener('storage', () => {
lastEmitedState = reducerLoad(getState());
store.commit('syncState', lastEmitedState);
lastEmittedState = reducerLoad(getState());
store.commit('syncState', lastEmittedState);
});
};

1 comment on commit 3e25e7e

@mradkov
Copy link
Contributor

@mradkov mradkov commented on 3e25e7e Oct 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.