Skip to content

Commit f9a62b9

Browse files
fix(label): clear timeout
- clean up setTimeout in disconnectedCallback
1 parent 1c89cf0 commit f9a62b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/components/label/label.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { Color, StyleEventDetail } from '../../interface';
1818
})
1919
export class Label implements ComponentInterface {
2020
private inRange = false;
21+
private loadTimeout?: number
2122

2223
@Element() el!: HTMLElement;
2324

@@ -56,12 +57,16 @@ export class Label implements ComponentInterface {
5657

5758
componentDidLoad() {
5859
if (this.noAnimate) {
59-
setTimeout(() => {
60+
this.loadTimeout = setTimeout(() => {
6061
this.noAnimate = false;
6162
}, 1000);
6263
}
6364
}
6465

66+
disconnectedCallback() {
67+
clearTimeout(this.loadTimeout)
68+
}
69+
6570
@Watch('color')
6671
colorChanged() {
6772
this.emitColor();

0 commit comments

Comments
 (0)