Repository navigation
fix(firestore): align updateDoc, onSnapshot and initializeFirestore error handling with firebase-js-sdk - #9392
Open
Mastersam07 wants to merge 4 commits into
Open
Mastersam07 wants to merge 4 commits into
Mastersam07 wants to merge 4 commits into
Conversation
6 of 9 tasks
Member
|
blocking until this lands: #9353 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three Firestore fixes that bring error handling in line with the firebase-js-sdk:
updateDoc: the field/value andFieldPathforms threw synchronously when a value was falsy (0,false,'',null). Those values now pass through. As in the firebase-js-sdk, only a string orFieldPathfirst argument selects the field/value form, and extra arguments after an update-data object are ignored.initializeFirestore: still returns synchronously, but invalid settings or a failure while applying them were left as an unhandled promise rejection. They are now reported withconsole.warn. A non-booleansettings.sslnow rejects like the other settings checks instead of throwing.onSnapshot: a loneonNext(or(options, onNext)) was called with(null, error)when the listener failed, sosnap => snap.data()threw. Errors now go only toonError/observer.error; with no error handler they are logged withconsole.error. Unlike the firebase-js-sdk,setLogLevel('silent')does not suppress this log.Docs are updated in the Firestore usage guide and the v26 migration guide. The branch also adds a note to the contributor validation checklist about a Jest test that needs a local iOS simulator.
Related issues
Release Summary
Firestore:
updateDocaccepts falsy values,initializeFirestorereports settings errors withconsole.warn, andonSnapshotno longer calls a lone success callback withnullon error.Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__Test Plan
updateDoc.test.ts,initializeFirestore.test.ts,onSnapshotCallbacks.test.ts(document and query listeners). Each fails on the previous code and passes with the fix.yarn tsc:compile,yarn tsc:compile:consumer,yarn lint:js,yarn lint:deps,yarn lint:markdown,yarn lint:spellcheck,yarn compare:types,yarn reference:apiandyarn attw:checkpass.yarn tests:jest: all Firestore suites pass (411 tests); 100% line and branch coverage on the changed code.Maintainer note: Fixes internal CPRN-554