(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
This commit is contained in:
Cyprien P 2022-12-15 16:07:27 +01:00
parent d107810127
commit 8227be513c

View File

@ -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;
}