Skip to content

Commit

Permalink
fix(AsyncAction): rescheduling an action with the same delay before i…
Browse files Browse the repository at this point in the history
…t has executed will now schedule appropriately. (#2580)

Rescheduling an async action with the same due time before its executed should cause it to cancel
its current interval and schedule a new one.

2579
  • Loading branch information
trxcllnt authored and benlesh committed May 2, 2017
1 parent bcc9702 commit 281760e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scheduler/AsyncAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ export class AsyncAction<T> extends Action<T> {

protected recycleAsyncId(scheduler: AsyncScheduler, id: any, delay: number = 0): any {
// If this action is rescheduled with the same delay time, don't clear the interval id.
if (delay !== null && this.delay === delay) {
if (delay !== null && this.delay === delay && this.pending === false) {
return id;
}
// Otherwise, if the action's delay time is different from the current delay,
// clear the interval id
// or the action has been rescheduled before it's executed, clear the interval id
return root.clearInterval(id) && undefined || undefined;
}

Expand Down

0 comments on commit 281760e

Please sign in to comment.