Skip to content
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

fix(emulator): protect against double useEmulator calls natively #6615

Merged
merged 6 commits into from
Oct 19, 2022

Conversation

mikehardy
Copy link
Collaborator

@mikehardy mikehardy commented Oct 19, 2022

Description

Most of the useEmulator calls (except functions?) are "call once only" with the native SDKs throwing errors or otherwise being upset by second calls

However, javascript bundles hot-reload so they cannot determine if they have already called useEmulator or not

Related issues

Noted in the specific commits targeted
Fixes #5860
Fixes #5650
Fixes #5723

Release Summary

a bunch of fix conventional commits

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

guards against case where hot-reload of javascript means state is lost
and second native calls are attempted (and rejected...)

Fixes #5650
In case of javascript hot reload, javascript will attempt to call useEmulator again,
and the native layer will complain about the second call. This avoids the second call
by tracking useEmulator call state at the native layer

Fixes #5860 (again, but this time per-app, and for android as well)
covers case where javascript hot-reloads and loses state then calls again
by tracking state of calls natively

Fixes #5723
in case javascript hot reloads, track useEmulator calls natively and
drop calls after the first one
@mikehardy mikehardy added the Workflow: Pending Merge Waiting on CI or similar label Oct 19, 2022
@vercel
Copy link

vercel bot commented Oct 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Oct 19, 2022 at 7:20PM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
react-native-firebase-next ⬜️ Ignored (Inspect) Oct 19, 2022 at 7:20PM (UTC)

@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Merging #6615 (f9fa9b4) into main (fe2bebe) will increase coverage by 17.78%.
The diff coverage is n/a.

❗ Current head f9fa9b4 differs from pull request most recent head 2674940. Consider uploading reports for the commit 2674940 to get more accurate results

@@              Coverage Diff              @@
##               main    #6615       +/-   ##
=============================================
+ Coverage     54.53%   72.30%   +17.78%     
=============================================
  Files           209      110       -99     
  Lines         10399     4678     -5721     
  Branches       1650     1051      -599     
=============================================
- Hits           5670     3382     -2288     
+ Misses         4445     1216     -3229     
+ Partials        284       80      -204     

@mikehardy mikehardy removed the Workflow: Pending Merge Waiting on CI or similar label Oct 19, 2022
@mikehardy mikehardy merged commit 13402d5 into main Oct 19, 2022
@mikehardy mikehardy deleted the @mikehardy/use-emulator-once-only branch October 19, 2022 20:02
@mikehardy mikehardy added the hacktoberfest-accepted Let's plant some trees! label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment