-
Notifications
You must be signed in to change notification settings - Fork 943
Update the JSDoc for enableIndexedDbPersistence #7852
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
…exedDbPersistence
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
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.
Looking at the code, I don't think the documentation updates are correct. It appears that both the enableIndexedDbPersistence()
and enableMultiTabIndexedDbPersistence()
functions directly throw exceptions for some problems, and return a promise that is ultimately rejected for other problems.
Specifically, it looks like they throw an exception when misused and return a promise that eventually gets rejected if some problem out of the programmer's control prevents persistence from being set (e.g. indexeddb is not available).
So I'd recommend to revert your changes in this PR, then, just add some information, to indicate that an exception is thrown if persistence has already been enabled or if it is too late to enable persistence. Of course, verify that this is indeed correct. I'm just concerned that the updated documentation is still not fully correct.
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.
A few minor nits. Please take my comments as suggestions, rather than orders.
In some situations,
enableIndexedDbPersistence
andenableMultiTabIndexedDbPersistence
throw an error instead of rejecting a promise. Rejected promise is documented as the way the error will be surfaced.firebase-js-sdk/packages/firestore/test/integration/browser/indexeddb.test.ts
Line 41 in 03ba262
firebase-js-sdk/packages/firestore/test/integration/api/provider.test.ts
Line 151 in 03ba262
Updated the documentation accordingly.