Skip to content

Commit

Permalink
fix(debounceTime): unschedule dangling task on unsubscribe before com…
Browse files Browse the repository at this point in the history
…plete
  • Loading branch information
backbone87 committed Jun 10, 2021
1 parent 4f4ac00 commit 4c7deff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internal/operators/debounceTime.ts
Expand Up @@ -85,7 +85,7 @@ export function debounceTime<T>(dueTime: number, scheduler: SchedulerLike = asyn
const now = scheduler.now();
if (now < targetTime) {
// On that case, re-schedule to the new target
activeTask = this.schedule(undefined, targetTime - now);
subscriber.add((activeTask = this.schedule(undefined, targetTime - now)));
return;
}

Expand All @@ -101,7 +101,7 @@ export function debounceTime<T>(dueTime: number, scheduler: SchedulerLike = asyn

// Only set up a task if it's not already up
if (!activeTask) {
activeTask = scheduler.schedule(emitWhenIdle, dueTime);
subscriber.add((activeTask = scheduler.schedule(emitWhenIdle, dueTime)));
}
},
() => {
Expand Down

0 comments on commit 4c7deff

Please sign in to comment.