-
Notifications
You must be signed in to change notification settings - Fork 893
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
Conversation
🦋 Changeset is good to goLatest commit: e9f508b We got this. This PR includes changesets to release 12 packages
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 |
Binary Size ReportAffected SDKs
Test Logs
|
.changeset/mean-jokes-tan.md
Outdated
'@firebase/firestore-types': patch | ||
--- | ||
|
||
feat: Added `inherit` setting to merge existing settings with new settings when calling `firestore.settings()`. |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return {...this._settings, ...settingsLiteral }
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
.changeset/mean-jokes-tan.md
Outdated
'@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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
packages/firebase/index.d.ts
Outdated
|
||
/** | ||
* Whether to merge the provided settings with the existing settings. If | ||
* set to `true`, the settings will be merged with existing settings. If |
There was a problem hiding this comment.
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..."
There was a problem hiding this 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!
Fixes #3354.