Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit a8b6fc7

Browse files
committed
Cancel the autosave timer on destroy
Seems to resolve the button bar issue on the create screen
1 parent b1e7b5a commit a8b6fc7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

source/behaviors/autosave/autosave.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ export class AutosaveDirective implements AfterViewInit {
3333
this.form.form.statusChanges.subscribe(this.setDebounce);
3434
}
3535

36+
ngOnDestroy(): void {
37+
if (this.timer) {
38+
this.timer.cancel();
39+
}
40+
}
41+
3642
setDebounce = (): void => {
3743
if (!this.timer && this.form.dirty && (this.saveWhenInvalid || this.form.validate())) {
3844
this.timer = this.timeoutService.setTimeout(this.autosave, DEFAULT_AUTOSAVE_DEBOUNCE)

0 commit comments

Comments
 (0)