From a2fe2c3bddc17cbdad6acae6b86b352a4ea14522 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 28 May 2022 14:21:13 -0700 Subject: FIx style issues --- modern/src/store/throttleMiddleware.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'modern') diff --git a/modern/src/store/throttleMiddleware.js b/modern/src/store/throttleMiddleware.js index 9954b139..d5a98add 100644 --- a/modern/src/store/throttleMiddleware.js +++ b/modern/src/store/throttleMiddleware.js @@ -1,4 +1,4 @@ -import { batch } from "react-redux"; +import { batch } from 'react-redux'; const threshold = 3; const interval = 1500; @@ -7,9 +7,8 @@ export default () => (next) => { const buffer = []; let throttle = false; let counter = 0; - + setInterval(() => { - console.log('batch'); if (throttle) { if (buffer.length < threshold) { throttle = false; @@ -24,16 +23,14 @@ export default () => (next) => { }, interval); return (action) => { - console.log(action); if (action.type === 'devices/update' || action.type === 'positions/update') { if (throttle) { buffer.push(action); - } else { - counter += 1; - return next(action); + return null; } - } else { + counter += 1; return next(action); } + return next(action); }; }; -- cgit v1.2.3