diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index fc01384f3..b3ac39f74 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -707,10 +707,25 @@ export default class DocumentsStore extends Store { params: Partial, options?: Record ): Promise { - const document = await super.update(params, options); - const collection = this.getCollectionForDocument(document); - void collection?.fetchDocuments({ force: true }); - return document; + this.isSaving = true; + + try { + const res = await client.post(`/${this.apiEndpoint}.update`, { + ...params, + ...options, + }); + invariant(res?.data, "Data should be available"); + + const collection = this.getCollectionForDocument(res.data); + await collection?.fetchDocuments({ force: true }); + + const document = this.add(res.data); + this.addPolicies(res.policies); + + return document; + } finally { + this.isSaving = false; + } } @action