Fix infinite spinner when trying to restore Send state (#2449)
Clear state when re-opening popup
This commit is contained in:
parent
7b08fc34ee
commit
ae83a693f4
|
@ -41,7 +41,11 @@ export class AppComponent implements OnInit {
|
||||||
private platformUtilsService: PlatformUtilsService
|
private platformUtilsService: PlatformUtilsService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
async ngOnInit() {
|
||||||
|
// Component states must not persist between closing and reopening the popup, otherwise they become dead objects
|
||||||
|
// Clear them aggressively to make sure this doesn't occur
|
||||||
|
await this.clearComponentStates();
|
||||||
|
|
||||||
this.stateService.activeAccount.subscribe((userId) => {
|
this.stateService.activeAccount.subscribe((userId) => {
|
||||||
this.activeUserId = userId;
|
this.activeUserId = userId;
|
||||||
});
|
});
|
||||||
|
@ -125,10 +129,7 @@ export class AppComponent implements OnInit {
|
||||||
(window as any).previousPopupUrl != null &&
|
(window as any).previousPopupUrl != null &&
|
||||||
(window as any).previousPopupUrl.startsWith("/tabs/")
|
(window as any).previousPopupUrl.startsWith("/tabs/")
|
||||||
) {
|
) {
|
||||||
await this.stateService.setBrowserGroupingComponentState(null);
|
await this.clearComponentStates();
|
||||||
await this.stateService.setBrowserCipherComponentState(null);
|
|
||||||
await this.stateService.setBrowserSendComponentState(null);
|
|
||||||
await this.stateService.setBrowserSendTypeComponentState(null);
|
|
||||||
}
|
}
|
||||||
if (url.startsWith("/tabs/")) {
|
if (url.startsWith("/tabs/")) {
|
||||||
await this.stateService.setAddEditCipherInfo(null);
|
await this.stateService.setAddEditCipherInfo(null);
|
||||||
|
@ -250,4 +251,13 @@ export class AppComponent implements OnInit {
|
||||||
confirmed: confirmed.value,
|
confirmed: confirmed.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async clearComponentStates() {
|
||||||
|
await Promise.all([
|
||||||
|
this.stateService.setBrowserGroupingComponentState(null),
|
||||||
|
this.stateService.setBrowserCipherComponentState(null),
|
||||||
|
this.stateService.setBrowserSendComponentState(null),
|
||||||
|
this.stateService.setBrowserSendTypeComponentState(null),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,7 @@ import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||||
import { SendType } from "jslib-common/enums/sendType";
|
import { SendType } from "jslib-common/enums/sendType";
|
||||||
import { SendView } from "jslib-common/models/view/sendView";
|
import { SendView } from "jslib-common/models/view/sendView";
|
||||||
|
|
||||||
import { BrowserSendComponentState } from "src/models/browserSendComponentState";
|
import { BrowserSendComponentState } from "../../models/browserSendComponentState";
|
||||||
|
|
||||||
import { StateService } from "../../services/abstractions/state.service";
|
import { StateService } from "../../services/abstractions/state.service";
|
||||||
import { PopupUtilsService } from "../services/popup-utils.service";
|
import { PopupUtilsService } from "../services/popup-utils.service";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue