Skip to content

Adding auth state ready() ax #7384

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

Merged
merged 24 commits into from
Jul 18, 2023
Merged

Adding auth state ready() ax #7384

merged 24 commits into from
Jul 18, 2023

Conversation

AngelAngelXie
Copy link
Contributor

@AngelAngelXie AngelAngelXie commented Jun 22, 2023

Fixes - #462

Implemented authStateReady() : This method returns a promise that resolves immediately when the initial auth state is settled and currentUser is available.

Added relevant unit tests to confirm the method works as expected.

Edited demo app to incorporate authStateReady() method when accessing current user.

  • kept activeUser(), which returns the last user OR currentUser without calling authStateReady(). This is needed for use cases where we simply want to check if there is currently a sign in user.
  • added getActiveUserAfterSignIn(), which returns the last user OR the currentUser once the user has completed signing in. This incorporates authStateReady() to make sure that currentUser information is retrieved after sign in has been successful.

@changeset-bot
Copy link

changeset-bot bot commented Jun 22, 2023

🦋 Changeset detected

Latest commit: d87d7ad

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 22, 2023

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    browser171 kB171 kB+178 B (+0.1%)
    cordova198 kB198 kB+238 B (+0.1%)
    esm5223 kB223 kB+238 B (+0.1%)
    main168 kB168 kB+238 B (+0.1%)
    module171 kB171 kB+178 B (+0.1%)
    react-native183 kB182 kB-604 B (-0.3%)
  • @firebase/auth/cordova

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    browser198 kB198 kB+238 B (+0.1%)
    module198 kB198 kB+238 B (+0.1%)
  • @firebase/auth/internal

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    browser181 kB182 kB+178 B (+0.1%)
    esm5237 kB237 kB+238 B (+0.1%)
    main204 kB204 kB+238 B (+0.1%)
    module181 kB182 kB+178 B (+0.1%)
  • @firebase/firestore

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    browser286 kB370 kB+84.1 kB (+29.4%)
    esm5355 kB356 kB+653 B (+0.2%)
    main568 kB569 kB+435 B (+0.1%)
    module286 kB370 kB+84.1 kB (+29.4%)
    react-native286 kB370 kB+84.1 kB (+29.3%)
  • @firebase/firestore-lite

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    browser88.3 kB110 kB+21.4 kB (+24.2%)
    esm5106 kB106 kB+187 B (+0.2%)
    main151 kB151 kB+5 B (+0.0%)
    module88.3 kB110 kB+21.4 kB (+24.2%)
    react-native88.5 kB110 kB+21.4 kB (+24.2%)
  • bundle

    18 size changes

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    auth (Anonymous)71.1 kB71.2 kB+130 B (+0.2%)
    auth (EmailAndPassword)76.1 kB76.2 kB+130 B (+0.2%)
    auth (GoogleFBTwitterGitHubPopup)97.3 kB97.5 kB+130 B (+0.1%)
    auth (GooglePopup)94.6 kB94.7 kB+130 B (+0.1%)
    auth (GoogleRedirect)94.8 kB95.0 kB+130 B (+0.1%)
    auth (Phone)81.0 kB81.1 kB+130 B (+0.2%)
    firestore (Persistence)300 kB301 kB+1.09 kB (+0.4%)
    firestore (Query Cursors)238 kB239 kB+798 B (+0.3%)
    firestore (Query)235 kB236 kB+794 B (+0.3%)
    firestore (Read data once)223 kB224 kB+764 B (+0.3%)
    firestore (Realtime updates)225 kB226 kB+768 B (+0.3%)
    firestore (Transaction)202 kB202 kB+552 B (+0.3%)
    firestore (Write data)202 kB202 kB+595 B (+0.3%)
    firestore-lite (Query Cursors)82.6 kB82.9 kB+312 B (+0.4%)
    firestore-lite (Query)78.7 kB79.0 kB+304 B (+0.4%)
    firestore-lite (Read data once)60.9 kB61.1 kB+206 B (+0.3%)
    firestore-lite (Transaction)85.6 kB85.9 kB+259 B (+0.3%)
    firestore-lite (Write data)70.4 kB70.6 kB+205 B (+0.3%)

  • firebase

    17 size changes

    TypeBase (fe2ac13)Merge (dd197dd)Diff
    firebase-analytics.js25.8 kB29.7 kB+3.92 kB (+15.2%)
    firebase-app-check.js22.1 kB25.0 kB+2.88 kB (+13.1%)
    firebase-auth-compat.js132 kB132 kB+125 B (+0.1%)
    firebase-auth-cordova.js147 kB169 kB+21.3 kB (+14.5%)
    firebase-auth.js127 kB142 kB+15.7 kB (+12.4%)
    firebase-compat.js773 kB774 kB+520 B (+0.1%)
    firebase-database.js154 kB181 kB+27.3 kB (+17.7%)
    firebase-firestore-compat.js339 kB340 kB+401 B (+0.1%)
    firebase-firestore-lite.js95.1 kB117 kB+22.3 kB (+23.4%)
    firebase-firestore.js346 kB430 kB+84.2 kB (+24.4%)
    firebase-functions.js11.0 kB11.9 kB+889 B (+8.0%)
    firebase-installations.js12.5 kB15.1 kB+2.61 kB (+20.8%)
    firebase-messaging-sw.js26.1 kB30.1 kB+3.98 kB (+15.2%)
    firebase-messaging.js24.9 kB28.8 kB+3.88 kB (+15.6%)
    firebase-performance.js30.8 kB35.0 kB+4.23 kB (+13.7%)
    firebase-remote-config.js26.3 kB29.6 kB+3.22 kB (+12.2%)
    firebase-storage.js40.3 kB46.4 kB+6.16 kB (+15.3%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/7bJx6wXgJ9.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 22, 2023

Size Analysis Report 1

This report is too large (2,184,466 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/8AdecKEGu8.html

@AngelAngelXie AngelAngelXie requested review from a team as code owners July 5, 2023 19:10
Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things to look at in the comments, thanks!

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AngelAngelXie AngelAngelXie merged commit 8e15973 into master Jul 18, 2023
@AngelAngelXie AngelAngelXie deleted the adding-authStateReady()-ax branch July 18, 2023 23:52
@google-oss-bot google-oss-bot mentioned this pull request Jul 18, 2023
@firebase firebase locked and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants