-
Notifications
You must be signed in to change notification settings - Fork 115
fix(ui_auth): Fix EmailVerificationController lifecycle #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Before this change, EmailVerificationController created during email verification workflow remained active on the background. When user signed out within the same session, FurebaseAuth.currentUser become null and the controller accessed it assuming it's never null. After the change, controller is disposed after leaving the verification screen.
…s disposed. When EmailVerificationController is no longer needed, it's disposed. However, sendVerificationEmail might still be running after disposal because it's async. It updates ValueNotifier's value, which throws an exception when called after dispose. This change prevents that by terminating sendVerificationEmail early when its result is no longer needed.
Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 15 days until this gets closed automatically |
The fix is still valid. We use it, and it works. |
Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 15 days until this gets closed automatically |
Even after two months, the fix is still valid. Awaiting feedback from the maintainer. |
Hello 👋, this PR has been opened for more than 2 months with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 15 days until this gets closed automatically |
The fix is still valid. |
Description
Fix EmailVerificationController lifecycle.
Before the change, each visit to
EmailVerificationScreen
creates a new controller that is kept indefinitely in the background and updated on the app resume. SinceEmailVerificationController
assumes that a user is logged in, these controller instances throw an exception when user logs out and app resume event is called.After this change, a
EmailVerificationController
is disposed when no longer needed by a screen that created it. If controller'ssendVerificationEmail
async method is still running during dispose, it is terminated early.Related Issues
Fixes #9
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).melos run analyze
) does not report any problems on my PR.melos run test:unit:all
doesn't fail).Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?