fix: clear timeout on disconnect callback
This commit is contained in:
parent
196b26c60e
commit
3985cf014e
@ -152,6 +152,7 @@ export class LogInPage extends LiteElement {
|
|||||||
|
|
||||||
@state()
|
@state()
|
||||||
private formState = machine.initialState;
|
private formState = machine.initialState;
|
||||||
|
private timerId?: number;
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
this.formStateService.subscribe((state) => {
|
this.formStateService.subscribe((state) => {
|
||||||
@ -164,6 +165,7 @@ export class LogInPage extends LiteElement {
|
|||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
this.formStateService.stop();
|
this.formStateService.stop();
|
||||||
|
window.clearTimeout(this.timeoutId);
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +291,7 @@ export class LogInPage extends LiteElement {
|
|||||||
|
|
||||||
<btrix-alert variant="warning" class="text-center"
|
<btrix-alert variant="warning" class="text-center"
|
||||||
>${msg(
|
>${msg(
|
||||||
"Please wait while the backend initializes"
|
"Please wait while Browsertrix Cloud is initializing"
|
||||||
)}</btrix-alert
|
)}</btrix-alert
|
||||||
>
|
>
|
||||||
</div>`
|
</div>`
|
||||||
@ -344,7 +346,7 @@ export class LogInPage extends LiteElement {
|
|||||||
this.formStateService.send("BACKEND_INITIALIZED");
|
this.formStateService.send("BACKEND_INITIALIZED");
|
||||||
} else {
|
} else {
|
||||||
this.formStateService.send("BACKEND_NOT_INITIALIZED");
|
this.formStateService.send("BACKEND_NOT_INITIALIZED");
|
||||||
setTimeout(() => this.checkBackendInitialized(), 5000);
|
this.timerId = setTimeout(() => this.checkBackendInitialized(), 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user