Skip to content

Commit

Permalink
Nuke batching actions
Browse files Browse the repository at this point in the history
Fix #208.
  • Loading branch information
zalmoxisus committed Sep 15, 2016
1 parent d7a199c commit 0d9c5ea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
11 changes: 0 additions & 11 deletions src/app/service/Monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ export default class Monitor {
this.active = false;
clearTimeout(this.waitingTimeout);
};
isWaiting = () => {
const currentTime = Date.now();
if (this.lastTime && currentTime - this.lastTime < 200) {
// no more frequently than once in 200ms
this.stop();
this.waitingTimeout = setTimeout(this.start, 1000);
return true;
}
this.lastTime = currentTime;
return false;
};
isHotReloaded = () => this.lastAction === '@@redux/INIT';
isMonitorAction = () => monitorActions.indexOf(this.lastAction) !== -1;
isTimeTraveling = () => this.lastAction === 'JUMP_TO_STATE';
Expand Down
4 changes: 1 addition & 3 deletions src/browser/extension/inject/pageScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ window.devToolsExtension = function(reducer, preloadedState, config) {
if (action.type === '@@INIT') {
relay('INIT', state, { timestamp: Date.now() });
} else if (!errorOccurred && !monitor.isMonitorAction()) {
if (
monitor.isTimeTraveling() || isFiltered(action, localFilter) || monitor.isWaiting()
) return;
if (monitor.isTimeTraveling() || isFiltered(action, localFilter)) return;
const { maxAge } = window.devToolsOptions;
relay('ACTION', state, liftedAction, nextActionId);
if (!isExcess && maxAge) isExcess = liftedState.stagedActionIds.length >= maxAge;
Expand Down
7 changes: 3 additions & 4 deletions test/app/inject/enhancer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ describe('Redux enhancer', () => {
window.store.dispatch({ type: 'INCREMENT' });
expect(window.store.getState()).toBe(2);
});
expect(message.type).toBe('STATE');
const count = message.payload.computedStates.length - 1;
expect(message.payload.actionsById[count].action.type).toBe('INCREMENT');
expect(message.payload.computedStates[count].state).toBe(2);
expect(message.type).toBe('ACTION');
expect(message.action.action.type).toBe('INCREMENT');
expect(message.payload).toBe(2);
});

it('should dispatch actions remotely', async () => {
Expand Down

0 comments on commit 0d9c5ea

Please sign in to comment.