From f58cc98e55439f01620620bfc4c462cb16fc4ee8 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 10 Jun 2021 10:32:37 +0200 Subject: [PATCH] Evict the event from the cache when it's deleted Signed-off-by: Thomas Citharel --- js/src/mixins/event.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/mixins/event.ts b/js/src/mixins/event.ts index f599fe810..b0a742855 100644 --- a/js/src/mixins/event.ts +++ b/js/src/mixins/event.ts @@ -150,7 +150,7 @@ export default class EventMixin extends mixins(Vue) { } private async deleteEvent(event: IEvent) { - const eventTitle = event.title; + const { title: eventTitle, id: eventId } = event; try { await this.$apollo.mutate({ @@ -159,6 +159,9 @@ export default class EventMixin extends mixins(Vue) { eventId: event.id, }, }); + const cache = this.$apollo.getClient().cache as InMemoryCache; + cache.evict({ id: `Event:${eventId}` }); + cache.gc(); /** * When the event corresponding has been deleted (by the organizer). * A notification is already triggered.