Skip to content

Commit 58edbb8

Browse files
committed
Add kill check to poll
1 parent fa412ce commit 58edbb8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/core/src/shared/globalState.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ export class GlobalStatePoller {
361361
* Starts polling the state value. When a change is detected, the changeHandler callback is invoked.
362362
*/
363363
private poll() {
364+
if (this.intervalId) {
365+
this.kill()
366+
}
364367
this.intervalId = setInterval(() => {
365368
const newValue = this.getState()
366369
if (this.oldValue !== newValue) {

0 commit comments

Comments
 (0)