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

Fire onInit callback if instance is already available #4971

Merged
merged 14 commits into from
Jun 9, 2021

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jun 3, 2021

This changes Firestore's initialization to detect Auth if Auth is available during client startup. Right now, we only detect once the setTimeout call fires.

Fixes #3218
Fixes #4953
Fixes #4932

@changeset-bot
Copy link

changeset-bot bot commented Jun 3, 2021

🦋 Changeset detected

Latest commit: 79f0a00

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

This PR includes changesets to release 14 packages
Name Type
@firebase/component Patch
@firebase/firestore Patch
@firebase/analytics Patch
@firebase/app-check Patch
@firebase/app Patch
@firebase/database Patch
@firebase/functions Patch
@firebase/installations Patch
@firebase/messaging Patch
@firebase/performance Patch
@firebase/remote-config Patch
@firebase/rules-unit-testing Patch
@firebase/storage Patch
firebase 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 3, 2021

Binary Size Report

Affected SDKs

  • @firebase/component

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 7.95 kB 8.33 kB +385 B (+4.8%)
    esm2017 6.00 kB 6.32 kB +323 B (+5.4%)
    main 8.29 kB 8.67 kB +385 B (+4.6%)
    module 7.95 kB 8.33 kB +385 B (+4.8%)
  • @firebase/firestore

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 284 kB 284 kB +21 B (+0.0%)
    esm2017 227 kB 227 kB +21 B (+0.0%)
    main 531 kB 531 kB +53 B (+0.0%)
    module 284 kB 284 kB +21 B (+0.0%)
    react-native 227 kB 227 kB +21 B (+0.0%)
  • @firebase/firestore-exp

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 224 kB 224 kB +21 B (+0.0%)
    main 511 kB 511 kB +53 B (+0.0%)
    module 224 kB 224 kB +21 B (+0.0%)
    react-native 224 kB 224 kB +21 B (+0.0%)
  • @firebase/firestore-lite

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 72.7 kB 72.7 kB +20 B (+0.0%)
    main 149 kB 149 kB +53 B (+0.0%)
    module 72.7 kB 72.7 kB +20 B (+0.0%)
    react-native 72.9 kB 72.9 kB +20 B (+0.0%)
  • @firebase/firestore/bundle

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 290 kB 290 kB +21 B (+0.0%)
    esm2017 177 kB 177 kB +21 B (+0.0%)
    main 527 kB 527 kB +53 B (+0.0%)
    module 290 kB 290 kB +21 B (+0.0%)
    react-native 177 kB 177 kB +21 B (+0.0%)
  • @firebase/firestore/memory

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 217 kB 217 kB +21 B (+0.0%)
    esm2017 172 kB 172 kB +21 B (+0.0%)
    main 325 kB 325 kB +53 B (+0.0%)
    module 217 kB 217 kB +21 B (+0.0%)
    react-native 172 kB 172 kB +21 B (+0.0%)
  • @firebase/firestore/memory-bundle

    Type Base (ed4f95c) Head (d3e02ac) Diff
    browser 225 kB 225 kB +21 B (+0.0%)
    esm2017 177 kB 177 kB +21 B (+0.0%)
    main 322 kB 322 kB +53 B (+0.0%)
    module 225 kB 225 kB +21 B (+0.0%)
    react-native 177 kB 177 kB +21 B (+0.0%)
  • firebase

    Type Base (ed4f95c) Head (d3e02ac) Diff
    firebase-app.js 21.8 kB 21.9 kB +97 B (+0.4%)
    firebase-database.js 187 kB 187 kB +97 B (+0.1%)
    firebase-firestore.js 335 kB 335 kB +21 B (+0.0%)
    firebase-firestore.memory.js 270 kB 270 kB +21 B (+0.0%)
    firebase-performance-standalone.es2017.js 73.2 kB 73.4 kB +162 B (+0.2%)
    firebase-performance-standalone.js 49.7 kB 49.8 kB +97 B (+0.2%)
    firebase.js 891 kB 891 kB +116 B (+0.0%)

Test Logs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 3, 2021

Size Analysis Report

Affected Products

  • @firebase/app-exp

    • initializeApp

      Size Table

      TypeBase (ed4f95c)Head (d3e02ac)Diff
      size-with-ext-deps
      11.1 kB
      11.3 kB
      +144 B (+1.3%)

packages/component/src/provider.ts Show resolved Hide resolved
this.onInitCallbacks.add(callback);

const instance = this.getImmediate({ identifier, optional: true });
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment that OnInit() is only intended to be used for EXPLICIT components, so getImmediate() will never initialize a new instance?

packages/component/.run/All Tests.run.xml Outdated Show resolved Hide resolved
packages/component/src/provider.test.ts Outdated Show resolved Hide resolved
packages/component/src/provider.ts Show resolved Hide resolved
packages/component/src/provider.ts Outdated Show resolved Hide resolved
packages/component/src/provider.ts Outdated Show resolved Hide resolved
Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

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

pending CI.

@schmidt-sebastian schmidt-sebastian merged commit 4c4b6ae into master Jun 9, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/fixauth branch June 9, 2021 23:07
This was referenced Jun 9, 2021
@firebase firebase locked and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants