Evict the event from the cache when it's deleted

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-10 10:32:37 +02:00
parent 60f5a76e57
commit f58cc98e55
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 4 additions and 1 deletions

View File

@ -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<IParticipant>({
@ -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.