aboutsummaryrefslogtreecommitdiff
path: root/modern/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/store')
-rw-r--r--modern/src/store/throttleMiddleware.js13
1 files changed, 5 insertions, 8 deletions
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);
};
};