Skip to content

Commit 8fb30b0

Browse files
committed
Prevent double messaging on autocommit
1 parent 3bd4fda commit 8fb30b0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/browser/extension/inject/pageScript.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ window.devToolsInit = function(store) {
77
let timeout = { id: null, last: 0};
88

99
function doChange(init) {
10-
let state = store.liftedStore.getState();
10+
const state = store.liftedStore.getState();
1111
if (options.limit && state.currentStateIndex > options.limit) {
1212
store.liftedStore.dispatch({type: COMMIT, timestamp: Date.now()});
13-
state = store.liftedStore.getState();
13+
return;
1414
}
1515
window.postMessage({
1616
payload: options.serialize ? stringify(state) : state,
@@ -49,13 +49,9 @@ window.devToolsInit = function(store) {
4949
if (message.type === ACTION) {
5050
timeout.last = 0;
5151
store.liftedStore.dispatch(message.payload);
52-
}
53-
54-
else if (message.type === UPDATE) {
52+
} else if (message.type === UPDATE) {
5553
onChange();
56-
}
57-
58-
else if (message.type === OPTIONS) {
54+
} else if (message.type === OPTIONS) {
5955
options = message.options;
6056
}
6157

0 commit comments

Comments
 (0)