fix: Local shares state not cleared when document is deleted

This commit is contained in:
Tom Moor
2020-08-31 20:28:41 -07:00
parent 759d4a5ac2
commit 31522b0d6f

View File

@@ -500,6 +500,13 @@ export default class DocumentsStore extends BaseStore<Document> {
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();
}