fix(firebase_core, web): return empty list from apps getter in WASM mode#17919
Conversation
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 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 counter productive. 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. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Fixes firebase#17918 The `apps` getter now checks if the Firebase core module is loaded before accessing `firebase.apps`. This avoids triggering a JavaScript exception when Firebase is not initialized, which is more efficient than relying on exception handling. This change ensures `Firebase.apps` returns an empty list in both JS and WASM web builds when called before `Firebase.initializeApp()`.
e89cfd2 to
4820a7b
Compare
|
Hi @davidmigloz, thanks for the contribution. LGTM! |
Summary
appsgetter to verify if the Firebase core module is loaded before accessingfirebase.appsFixes #17918
Changes
packages/firebase_core/firebase_core_web/lib/src/firebase_core_web.dartAdded a check using the existing pattern from
_initializeCore():packages/firebase_core/firebase_core_web/test/firebase_core_web_exceptions_test.dartAdded a test to verify
appsreturns an empty list when Firebase is not initialized.Test plan
appsgetterflutter test --platform chrome)flutter run -d chrome --release --wasm # Access Firebase.apps before initializeApp() - should return []🤖 Generated with Claude Code