Skip to content

Commit

Permalink
Fix throttler calling an action twice
Browse files Browse the repository at this point in the history
There is a bug in throttler where an action is called immediately and also again when the Timer expires despite only being scheduled once by call(). This commit resets the action to null once it is completed.
  • Loading branch information
yangsfang committed Sep 22, 2023
1 parent 8a29d67 commit 509487f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/logic/common/throttler.dart
Expand Up @@ -25,6 +25,7 @@ class Throttler {

void _callAction() {
_action?.call(); // If we have an action queued up, complete it.
_action = null; // Once an action is called, do not call the same action again unless another action is queued.
_timer = null;
}

Expand Down

0 comments on commit 509487f

Please sign in to comment.