diff --git a/src/core/EventCache.ts b/src/core/EventCache.ts index 4178c76..bdc168c 100644 --- a/src/core/EventCache.ts +++ b/src/core/EventCache.ts @@ -567,14 +567,16 @@ export default class EventCache { location, calendarId: calendar.id, })); - newEvents.forEach(({ event, id, location }) => { - this.store.add({ - calendar, - location, - id, - event, + newEvents + .filter(({ id }) => !this.store.has(id)) + .forEach(({ event, id, location }) => { + this.store.add({ + calendar, + location, + id, + event, + }); }); - }); this.updateCalendar({ id: calendar.id, editable: false, diff --git a/src/core/EventStore.ts b/src/core/EventStore.ts index 405d83b..49bbfe8 100644 --- a/src/core/EventStore.ts +++ b/src/core/EventStore.ts @@ -192,6 +192,10 @@ export default class EventStore { return result; } + has(id: string): boolean { + return this.store.has(id); + } + /** * Add a new event to the store with given associations. * @param param0