Repository navigation
fix(core, web): skip hot-restart listener cleanup in profile mode - #18729
Conversation
Profile builds left dart.vm.product unset, so web listeners were stored under the shared 'no-op' key and the next subscription cancelled them.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 馃憤 and 馃憥 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
Description
Profile web builds were still storing hot-restart unsubscribe functions on
window.firebase_auth_webonly assigns a unique listener key when Flutter'skDebugModeis true, so in profile every listener usedno-op.firebase_core_webtreated profile as debug because it only checkeddart.vm.product, which stays false in profile. CreatingFirebaseAuthsubscribes to auth state and then to the ID token, so the second subscription cancelled the first before Firebase Auth could emit.authStateChanges()then never fired.The core flag now matches Flutter's
kDebugMode(!dart.vm.product && !dart.vm.profile). Debug builds still save unsubscribe functions for hot restart. Profile and release builds do not. Firestore, Storage, and App Check share this helper and the sameno-opkey, so they pick up the same fix.Related Issues
Fixes #18728
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.yamland changelogs is not required.///).melos run analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
Test plan
auth js unsubscribe called). After the fix, profile emitted, with both keys stillno-opand no unsubscribe call. Release and debug emitted before and after.dart analyze packages/firebase_core/firebase_core_web/lib/src/interop/utils/utils.dartThe flag is a compile-time constant, so a debug
flutter testrun cannot observe the profile branch. The full package test suite andmelos run analyzewere not run.