fix: debounce the events update to prevent ghosts
This commit is contained in:
parent
503eecf33e
commit
74602a29d9
3 changed files with 15 additions and 2 deletions
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -13,6 +13,7 @@
|
|||
"@fullcalendar/rrule": "^5.10.1",
|
||||
"@nextcloud/cdav-library": "^1.0.0",
|
||||
"ical.js": "^1.5.0",
|
||||
"lodash": "^4.17.21",
|
||||
"rrule": "^2.6.8",
|
||||
"sirv-cli": "^1.0.0",
|
||||
"svelte-simple-modal": "^1.3.1"
|
||||
|
@ -1744,6 +1745,11 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.camelcase": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||
|
@ -5068,6 +5074,11 @@
|
|||
"resolved": "https://registry.npmjs.org/local-access/-/local-access-1.1.0.tgz",
|
||||
"integrity": "sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw=="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"lodash.camelcase": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"@fullcalendar/rrule": "^5.10.1",
|
||||
"@nextcloud/cdav-library": "^1.0.0",
|
||||
"ical.js": "^1.5.0",
|
||||
"lodash": "^4.17.21",
|
||||
"rrule": "^2.6.8",
|
||||
"sirv-cli": "^1.0.0",
|
||||
"svelte-simple-modal": "^1.3.1"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
import EventDetails from './EventDetails.svelte';
|
||||
import FilterBar from './FilterBar.svelte';
|
||||
import { refreshEvents, calendarTree } from './calendar';
|
||||
import { debounce } from 'lodash';
|
||||
|
||||
const modal = writable(null);
|
||||
let calendar;
|
||||
|
@ -43,14 +44,14 @@
|
|||
return evts.flat();
|
||||
}
|
||||
|
||||
function updateEvents(calendars) {
|
||||
const updateEvents = debounce(calendars => {
|
||||
return reloadEvents(calendars).then(events => {
|
||||
options.update(opts => ({
|
||||
...opts,
|
||||
events
|
||||
}));
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
|
||||
|
||||
onMount(async () => {
|
||||
|
|
Loading…
Reference in a new issue