File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class AuthenticationBloc
47
47
48
48
final AuthRepository _authenticationRepository;
49
49
late final StreamSubscription <User ?> _userAuthSubscription;
50
+ Timer ? _cooldownTimer;
50
51
51
52
/// Handles [_AuthenticationStatusChanged] events.
52
53
Future <void > _onAuthenticationStatusChanged (
@@ -97,7 +98,8 @@ class AuthenticationBloc
97
98
);
98
99
99
100
// Start a timer to transition out of cooldown
100
- Timer (
101
+ _cooldownTimer? .cancel ();
102
+ _cooldownTimer = Timer (
101
103
_requestCodeCooldownDuration,
102
104
() => add (const AuthenticationCooldownCompleted ()),
103
105
);
@@ -213,6 +215,7 @@ class AuthenticationBloc
213
215
@override
214
216
Future <void > close () {
215
217
_userAuthSubscription.cancel ();
218
+ _cooldownTimer? .cancel ();
216
219
return super .close ();
217
220
}
218
221
}
Original file line number Diff line number Diff line change @@ -222,10 +222,8 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
222
222
setState (() {
223
223
_cooldownSeconds = 0 ;
224
224
});
225
- // Optionally, trigger an event to reset the bloc state if needed
226
- context
227
- .read <AuthenticationBloc >()
228
- .add (const AuthenticationCooldownCompleted ());
225
+ // The BLoC handles resetting its own state. The UI timer is only
226
+ // responsible for updating the countdown on the screen.
229
227
}
230
228
});
231
229
}
You can’t perform that action at this time.
0 commit comments