From 509487f7899bae89a925d7a0e8c02424166b7261 Mon Sep 17 00:00:00 2001 From: Yang Fang <31492969+yangsfang@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:26:41 -0700 Subject: [PATCH] Fix throttler calling an action twice 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. --- lib/logic/common/throttler.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/logic/common/throttler.dart b/lib/logic/common/throttler.dart index 65fd4ee1..8c6df454 100644 --- a/lib/logic/common/throttler.dart +++ b/lib/logic/common/throttler.dart @@ -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; }