mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
prevent loading users calendar multiple times when adding multiple users
This commit is contained in:
parent
00ef58301e
commit
d32a69a657
@ -10,6 +10,8 @@ import {
|
|||||||
} from './../api';
|
} from './../api';
|
||||||
import {datetimeToISO} from 'ChillMainAssets/chill/js/date';
|
import {datetimeToISO} from 'ChillMainAssets/chill/js/date';
|
||||||
|
|
||||||
|
const fetchings = new Set();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setCurrentDatesView({ commit, dispatch }, {start, end}) {
|
setCurrentDatesView({ commit, dispatch }, {start, end}) {
|
||||||
commit('setCurrentDatesView', {start, end});
|
commit('setCurrentDatesView', {start, end});
|
||||||
@ -23,6 +25,15 @@ export default {
|
|||||||
|
|
||||||
let promises = [];
|
let promises = [];
|
||||||
for (const uid of state.currentView.users.keys()) {
|
for (const uid of state.currentView.users.keys()) {
|
||||||
|
let unique = `${uid}, ${state.currentView.start.toISOString()}, ${state.currentView.end.toISOString()}`;
|
||||||
|
|
||||||
|
if (fetchings.has(unique)) {
|
||||||
|
console.log('prevent from fetching for a user', unique);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchings.add(unique);
|
||||||
|
|
||||||
promises.push(
|
promises.push(
|
||||||
dispatch(
|
dispatch(
|
||||||
'fetchCalendarRangeForUser',
|
'fetchCalendarRangeForUser',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user