From 8227be513c187a0056f9ed282e141412c019fb3f Mon Sep 17 00:00:00 2001 From: Cyprien P Date: Thu, 15 Dec 2022 16:07:27 +0100 Subject: [PATCH] (core) Fix UI losing view as mode after updating doc sharing Summary: Fix issue where the view-as banner disappears when saving changes on the User Manager panel while view-as mode was ON. Test Plan: Updates nbrowser test Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3754 --- app/client/models/DocPageModel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/client/models/DocPageModel.ts b/app/client/models/DocPageModel.ts index a6ebd15c..f0f42c36 100644 --- a/app/client/models/DocPageModel.ts +++ b/app/client/models/DocPageModel.ts @@ -211,7 +211,9 @@ export class DocPageModelImpl extends Disposable implements DocPageModel { public async updateCurrentDoc(urlId: string, openMode: OpenDocMode) { // TODO It would be bad if a new doc gets opened while this getDoc() is pending... const newDoc = await getDoc(this._api, urlId); - this.currentDoc.set(buildDocInfo(newDoc, openMode)); + const isRecoveryMode = Boolean(this.currentDoc.get()?.isRecoveryMode); + const userOverride = this.currentDoc.get()?.userOverride || null; + this.currentDoc.set({...buildDocInfo(newDoc, openMode), isRecoveryMode, userOverride}); return newDoc; }