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

View File

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

View File

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