diff options
author | dartcafe <github@dartcafe.de> | 2021-02-28 17:10:09 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-02-28 17:10:09 +0300 |
commit | c7c2096226d6a9386dbcb26f42161306207171d8 (patch) | |
tree | 882e6b3bdedd807c9bb34670b3fe141ba5e395e8 /src/js/mixins | |
parent | 0b0ce15ed84accf090c81e4202763d26dd5e4e35 (diff) |
avoid doubled dispatches
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/mixins')
-rw-r--r-- | src/js/mixins/watchPolls.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/js/mixins/watchPolls.js b/src/js/mixins/watchPolls.js index 9d8916d0..aea224ca 100644 --- a/src/js/mixins/watchPolls.js +++ b/src/js/mixins/watchPolls.js @@ -35,7 +35,7 @@ export const watchPolls = { params: { offset: this.lastUpdated }, cancelToken: this.cancelToken.token, }) - const dispatches = [] + let dispatches = [] console.debug('polls', 'update detected', response.data.updates) @@ -58,6 +58,8 @@ export const watchPolls = { } }) + // remove duplicates + dispatches = [...new Set(dispatches)] // execute all loads within one promise const requests = dispatches.map(dispatches => this.$store.dispatch(dispatches)) await Promise.all(requests) |