The verification panel would only render correctly once.
This was due to a race in the right panel navigation code.
This commit is contained in:
RMidhunSuresh 2023-04-18 18:02:52 +05:30
parent 08398b064a
commit 82502e3bb1
3 changed files with 10 additions and 6 deletions

View File

@ -77,14 +77,17 @@ export class RightPanelViewModel extends ViewModel {
}); });
} }
_hookUpdaterToSegment(segment, viewmodel, argCreator, failCallback) { async _hookUpdaterToSegment(segment, ViewModel, argCreator, failCallback) {
const observable = this.navigation.observe(segment); const observable = this.navigation.observe(segment);
const updater = this._setupUpdater(segment, viewmodel, argCreator, failCallback); const updater = await this._setupUpdater(segment, ViewModel, argCreator, failCallback);
this.track(observable.subscribe(updater)); this.track(observable.subscribe(updater));
} }
_setupUpdater(segment, viewmodel, argCreator, failCallback) { async _setupUpdater(segment, ViewModel, argCreator, failCallback) {
const updater = async (skipDispose = false) => { const updater = async (skipDispose = false) => {
if (this._activeViewModel instanceof ViewModel) {
return;
}
if (!skipDispose) { if (!skipDispose) {
this._activeViewModel = this.disposeTracked(this._activeViewModel); this._activeViewModel = this.disposeTracked(this._activeViewModel);
} }
@ -95,11 +98,11 @@ export class RightPanelViewModel extends ViewModel {
failCallback(); failCallback();
return; return;
} }
this._activeViewModel = this.track(new viewmodel(this.childOptions(args))); this._activeViewModel = this.track(new ViewModel(this.childOptions(args)));
} }
this.emitChange("activeViewModel"); this.emitChange("activeViewModel");
}; };
updater(true); await updater(true);
return updater; return updater;
} }

View File

@ -183,6 +183,7 @@ export class RoomChannel extends Disposables implements IChannel {
async cancelVerification(cancellationType: CancelReason) { async cancelVerification(cancellationType: CancelReason) {
await this.log.wrap("RoomChannel.cancelVerification", async log => { await this.log.wrap("RoomChannel.cancelVerification", async log => {
log.log({ reason: messageFromErrorType[cancellationType] });
if (this.isCancelled) { if (this.isCancelled) {
throw new VerificationCancelledError(); throw new VerificationCancelledError();
} }

View File

@ -56,7 +56,7 @@ class ButtonsView extends TemplateView {
className: { className: {
"back": true, "back": true,
"button-utility": true, "button-utility": true,
"hide": !vm.activeViewModel.shouldShowBackButton "hide": (vm) => !vm.activeViewModel.shouldShowBackButton
}, onClick: () => vm.showPreviousPanel()}), }, onClick: () => vm.showPreviousPanel()}),
t.button({className: "close button-utility", onClick: () => vm.closePanel()}) t.button({className: "close button-utility", onClick: () => vm.closePanel()})
]); ]);