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

Remove dependency on @react-native-async-storage/async-storage #7570

Merged
merged 5 commits into from
Aug 22, 2023

Conversation

hsubox76
Copy link
Contributor

@hsubox76 hsubox76 commented Aug 17, 2023

See #7522

In 10.0.0 we added @react-native-async-storage/async-storage as a dependency to make things more convenient for React Native users, enabling us to automatically include it as a persistence method for auth. Unfortunately this causes a number of warnings and unexpected issues for non-React Native users. We cannot give the React Native bundle a separate set of dependencies without making a separate NPM package for it. The best compromise is to set the dependency list in a way that works for the majority of users, and document how React Native users can provide an AsyncStorage import to enable auth state persistence.

So this involves 2 steps:

  1. Move the dependency to an optional peerDependency, using peerDependenciesMeta to flag it as optional. This will prevent warnings in the latest versions of all major package installers, including npm, yarn, and pnpm.
  2. Added a warning that will display to RN users who call getAuth() or who call initializeAuth() without providing a persistence option. The warning will only appear to users of the RN bundle, and will go away if they provide a persistence option to initializeAuth().

This will break RN users who have already converted to using getAuth() with version 10, but since that release was only a month ago, the sooner we get this out, the sooner we can catch any other users before they convert over. Also, the current getAuth() users should get the prominent warning.

Testing

Manually tested in RN using Expo - it shows the warning when expected - note the warning is in the terminal and doesn't pop up nicely in the simulator toast.

Manually tested npm and yarn installs - warning is gone.

@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2023

🦋 Changeset detected

Latest commit: 4c64fa2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/auth Minor
firebase Minor
@firebase/auth-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 17, 2023

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 17, 2023

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (345d198)Merge (59893af)Diff
    react-native190 kB190 kB+491 B (+0.3%)
  • @firebase/firestore

    TypeBase (345d198)Merge (59893af)Diff
    browser371 kB371 kB-46 B (-0.0%)
    esm5356 kB356 kB-47 B (-0.0%)
    module371 kB371 kB-46 B (-0.0%)
    react-native371 kB371 kB-47 B (-0.0%)
  • bundle

    TypeBase (345d198)Merge (59893af)Diff
    firestore (Persistence)300 kB300 kB-17 B (-0.0%)
    firestore (Query Cursors)238 kB238 kB-17 B (-0.0%)
    firestore (Query)235 kB235 kB-17 B (-0.0%)
    firestore (Read data once)223 kB223 kB-17 B (-0.0%)
    firestore (Realtime updates)225 kB225 kB-17 B (-0.0%)
    firestore (Transaction)203 kB203 kB-17 B (-0.0%)
    firestore (Write data)203 kB203 kB-17 B (-0.0%)
  • firebase

    TypeBase (345d198)Merge (59893af)Diff
    firebase-compat.js777 kB777 kB-13 B (-0.0%)
    firebase-firestore-compat.js339 kB339 kB-13 B (-0.0%)
    firebase-firestore.js430 kB430 kB+15 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/TzjOZkuMQD.html
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 17, 2023

Size Analysis Report 1

This report is too large (128,016 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/fKMzLAxDd7.html
@hsubox76
Copy link
Contributor Author

hsubox76 commented Aug 18, 2023

I added it back as an optional peerDependency using peerDependenciesMeta and updated the description.

Edit: Tested it using npm and yarn and got no warnings.

@hsubox76 hsubox76 marked this pull request as ready for review August 18, 2023 19:23
@hsubox76 hsubox76 requested review from a team, lisajian, renkelvin and sam-gc as code owners August 18, 2023 19:23
@hsubox76 hsubox76 requested a review from prameshj August 18, 2023 21:13
@hsubox76 hsubox76 merged commit 309f7a9 into master Aug 22, 2023
@hsubox76 hsubox76 deleted the ch-rnfix branch August 22, 2023 17:59
@google-oss-bot google-oss-bot mentioned this pull request Aug 22, 2023
@firebase firebase locked and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
5 participants