From 31522b0d6f2bc6edc87b0d278ae4838998e4b809 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 31 Aug 2020 20:28:41 -0700 Subject: [PATCH] fix: Local shares state not cleared when document is deleted --- app/stores/DocumentsStore.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/stores/DocumentsStore.js b/app/stores/DocumentsStore.js index 41bdb1cf7..d1b19ef56 100644 --- a/app/stores/DocumentsStore.js +++ b/app/stores/DocumentsStore.js @@ -500,6 +500,13 @@ export default class DocumentsStore extends BaseStore { this.recentlyViewedIds = without(this.recentlyViewedIds, document.id); }); + // check to see if we have any shares related to this document already + // loaded in local state. If so we can go ahead and remove those too. + const share = this.rootStore.shares.getByDocumentId(document.id); + if (share) { + this.rootStore.shares.remove(share.id); + } + const collection = this.getCollectionForDocument(document); if (collection) collection.refresh(); }