Skip to content

Extract Offline-only component provider #3460

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 5 commits into from
Jul 25, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Jul 23, 2020

This is the next PR in the infinite series that will eventually be #3425

It changes the component providers so that it is possible to only instantiate the components that are needed for cache-only queries.

There are now:

  • MemoryOfflineComponentProvider
  • IndexedDbOfflineComponentProvider
  • MultiTabOfflineComponentProvider
  • OnlineComponentProvider

The offline providers provide LocalStore, Persistence and related classes. OnlineComponentProvider provides SyncEngine and RemoteStore (among others).

MultiTabOfflineComponentProvider depends on OnlineComponentProvider. That means that in Multi-Tab mode, even a client that only uses getDocsFromCache will bundle RemoteStore and SyncEngine. This is probably what we want though, since it may have to listen to queries from secondary tabs.

@changeset-bot
Copy link

changeset-bot bot commented Jul 23, 2020

💥 No Changeset

Latest commit: 2ccff75

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 23, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (2dd560b) Head (7f2bf8a) Diff
    browser 246 kB 246 kB +527 B (+0.2%)
    esm2017 193 kB 193 kB +187 B (+0.1%)
    main 469 kB 471 kB +1.59 kB (+0.3%)
    module 243 kB 244 kB +483 B (+0.2%)
    react-native 193 kB 193 kB +187 B (+0.1%)
  • @firebase/firestore/exp

    Type Base (2dd560b) Head (7f2bf8a) Diff
    browser 187 kB 187 kB +152 B (+0.1%)
    main 511 kB 513 kB +1.72 kB (+0.3%)
    module 187 kB 187 kB +152 B (+0.1%)
    react-native 187 kB 187 kB +152 B (+0.1%)
  • @firebase/firestore/lite

    Type Base (2dd560b) Head (7f2bf8a) Diff
    main 497 kB 499 kB +1.43 kB (+0.3%)
  • @firebase/firestore/memory

    Type Base (2dd560b) Head (7f2bf8a) Diff
    browser 184 kB 185 kB +367 B (+0.2%)
    esm2017 145 kB 145 kB +175 B (+0.1%)
    main 344 kB 346 kB +1.31 kB (+0.4%)
    module 182 kB 183 kB +345 B (+0.2%)
    react-native 145 kB 145 kB +175 B (+0.1%)
  • firebase

    Type Base (2dd560b) Head (7f2bf8a) Diff
    firebase-firestore.js 282 kB 283 kB +455 B (+0.2%)
    firebase-firestore.memory.js 223 kB 223 kB +329 B (+0.1%)
    firebase.js 815 kB 816 kB +459 B (+0.1%)

Test Logs

@@ -18,7 +18,7 @@
"dev": "rollup -c -w",
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"prettier": "prettier --write '*.js' '{,!(dist)}/**/*.ts'",
"prettier": "prettier --write '*.js' '*.ts' '{,!(dist)}/**/*.ts'",
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: what's the reason for this addition? Shouldn't the glob on the right cover it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to figure this out with https://globster.xyz/, but it seems to slightly disagree with what we have. I think '{,!(dist)}/**/*.ts' doesn't match since it requires at least one level of nesting.

@schmidt-sebastian schmidt-sebastian merged commit 1fb82be into master Jul 25, 2020
@firebase firebase locked and limited conversation to collaborators Aug 25, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/components branch November 9, 2020 22:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants