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

add option to merge settings #3464

Merged
merged 13 commits into from
Aug 19, 2020
Merged

add option to merge settings #3464

merged 13 commits into from
Aug 19, 2020

Conversation

thebrianchen
Copy link

@thebrianchen thebrianchen commented Jul 24, 2020

Fixes #3354.

@changeset-bot
Copy link

changeset-bot bot commented Jul 24, 2020

🦋 Changeset is good to go

Latest commit: e9f508b

We got this.

This PR includes changesets to release 12 packages
Name Type
firebase Patch
@firebase/firestore Patch
@firebase/firestore-types Patch
@firebase/rules-unit-testing Patch
@firebase/testing Patch
firebase-browserify-test Patch
firebase-package-typings-test Patch
firebase-messaging-selenium-test Patch
firebase-typescript-test Patch
firebase-webpack-test Patch
firebase-exp Patch
firebase-firestore-integration-test 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 Jul 24, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore

    Type Base (9f58f6d) Head (262a69e) Diff
    browser 249 kB 249 kB +158 B (+0.1%)
    esm2017 195 kB 196 kB +136 B (+0.1%)
    main 475 kB 476 kB +250 B (+0.1%)
    module 246 kB 247 kB +158 B (+0.1%)
    react-native 196 kB 196 kB +136 B (+0.1%)
  • @firebase/firestore/memory

    Type Base (9f58f6d) Head (262a69e) Diff
    browser 187 kB 187 kB +158 B (+0.1%)
    esm2017 147 kB 147 kB +136 B (+0.1%)
    main 349 kB 349 kB +250 B (+0.1%)
    module 185 kB 185 kB +158 B (+0.1%)
    react-native 147 kB 147 kB +136 B (+0.1%)
  • firebase

    Type Base (9f58f6d) Head (262a69e) Diff
    firebase-firestore.js 287 kB 288 kB +159 B (+0.1%)
    firebase-firestore.memory.js 227 kB 227 kB +159 B (+0.1%)
    firebase.js 823 kB 823 kB +159 B (+0.0%)

Test Logs

'@firebase/firestore-types': patch
---

feat: Added `inherit` setting to merge existing settings with new settings when calling `firestore.settings()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something with "the settings from a previous call. This allows customizing custom settings on top of the settings that were applied by @firestore/testing. Yadadada."

Copy link
Author

Choose a reason for hiding this comment

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

updated.

Comment on lines 391 to 412
settingsLiteral.host =
settingsLiteral.host === undefined
? this._settings.host
: settingsLiteral.host;
settingsLiteral.ssl =
settingsLiteral.ssl === undefined
? this._settings.ssl
: settingsLiteral.ssl;
settingsLiteral.timestampsInSnapshots =
settingsLiteral.timestampsInSnapshots === undefined
? this._settings.timestampsInSnapshots
: settingsLiteral.timestampsInSnapshots;
settingsLiteral.cacheSizeBytes =
settingsLiteral.cacheSizeBytes === undefined
? this._settings.cacheSizeBytes
: settingsLiteral.cacheSizeBytes;
settingsLiteral.ignoreUndefinedProperties =
settingsLiteral.ignoreUndefinedProperties === undefined
? this._settings.ignoreUndefinedProperties
: settingsLiteral.ignoreUndefinedProperties;

return settingsLiteral;
Copy link
Contributor

Choose a reason for hiding this comment

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

return {...this._settings, ...settingsLiteral }

Copy link
Author

Choose a reason for hiding this comment

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

done. Renamed forceLongPolling to experimentalForceLongPolling in order to use spread operator properly.

@@ -57,6 +57,17 @@ export function firestore(): Firestore {
return FIRESTORE;
}

export function namedFirestore(projectId: string): Firestore {
return new Firestore(
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need the name, do you? I think you just need to return a new instance. This could just be newTestFirstore().

Copy link
Author

Choose a reason for hiding this comment

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

done.

'@firebase/firestore': patch
'@firebase/firestore-types': patch
---
feat: Added `inherit` setting to merge the new settings with the settings from a previous call when calling `firestore.settings()`. This allows adding settings on top of the settings that were applied by `@firebase/testing`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
feat: Added `inherit` setting to merge the new settings with the settings from a previous call when calling `firestore.settings()`. This allows adding settings on top of the settings that were applied by `@firebase/testing`.
feat: Added `inherit` option to `firestore.settings()`, which merges the provided settings with settings from a previous call . This allows adding settings on top of the settings that were applied by `@firebase/testing`.
Also line wrap.


/**
* Whether to merge the provided settings with the existing settings. If
* set to `true`, the settings will be merged with existing settings. If
Copy link
Contributor

Choose a reason for hiding this comment

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

We avoid "will" when possible. So this could be "are merged" and the line below just "settings replace..."

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.

LG with one nit, thanks!

@thebrianchen thebrianchen merged commit 61b4cd3 into master Aug 19, 2020
@thebrianchen thebrianchen deleted the bc/merge-settings branch August 19, 2020 02:50
This was referenced Aug 25, 2020
@firebase firebase locked and limited conversation to collaborators Sep 19, 2020
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.

Calling app.firestore().settings() from @firebase/testing breaks the app
5 participants