-
Notifications
You must be signed in to change notification settings - Fork 927
Don't normalize Proto data during deepClone #5147
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
Conversation
🦋 Changeset detectedLatest commit: 90f8aa0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
Changeset File Check
|
…-sdk into mrschmidt/deepclone
Binary Size ReportAffected SDKs
Test Logs |
Size Analysis ReportAffected Products
|
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.
lgtm, since I'll be OOO. I see a failing transaction JSON test, which could be related to this change.
.changeset/thirty-suits-switch.md
Outdated
"@firebase/firestore": patch | ||
--- | ||
|
||
Fixes an issue that prevented Timestamps to be used via `update()` when connected to the Emulator |
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.
nit: s/Fixes/Fixed, s/to be/from being
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
@@ -15,12 +15,12 @@ | |||
* limitations under the License. | |||
*/ | |||
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies |
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.
any reason to move this?
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.
It's now causing a Lint failure (some tools have been updated)
return { timestampValue: { ...normalizeTimestamp(source.timestampValue) } }; | ||
} else if ( | ||
source.timestampValue && | ||
typeof source.timestampValue === 'object' |
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.
I don't follow why we need the typeof
check in the else if
block. In what conditions does timestampValue
not have type object
? Do we need an separate condition to handle that, or does returning {...source}
in the else
statement work?
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.
The timestampValue can be a string, in which case {...}
does not work. It would create an array of characters.
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.
Thanks for the review. The failing test is from RTDB, but thanks for checking.
@@ -15,12 +15,12 @@ | |||
* limitations under the License. | |||
*/ | |||
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies |
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.
It's now causing a Lint failure (some tools have been updated)
.changeset/thirty-suits-switch.md
Outdated
"@firebase/firestore": patch | ||
--- | ||
|
||
Fixes an issue that prevented Timestamps to be used via `update()` when connected to the Emulator |
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
return { timestampValue: { ...normalizeTimestamp(source.timestampValue) } }; | ||
} else if ( | ||
source.timestampValue && | ||
typeof source.timestampValue === 'object' |
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.
The timestampValue can be a string, in which case {...}
does not work. It would create an array of characters.
The SDK normalizes all Proto data into ProtobufJS before operating on them. This means that internally we use
{ seconds, nanos }
. When we send data via WebChannel, we need to use Proto3 JSON. Unfortunately, in one of the code paths we needlessly normalize the Date data and storing it in a document.Fixes #5047