firebase-js-sdk
firebase-js-sdk copied to clipboard
Error thrown: Firestore has already been started and persistence can no longer be enabled
I see you are throwing an error in certain situations when trying to setup firebase offline persistence:
https://github.com/firebase/firebase-js-sdk/blob/f5426a51275bb611a5d9a6df3200d0fe5095afa2/packages/firestore/src/api/database.ts#L561-L565
This is completely unexpected, not documented and I think it is a bad idea. The documentation says that, in case of error you will get a rejected promise, which is what I am coding for and what I a m guarding against, however, to my surprise a plain sync error is just thrown and therefore I am not notified in any way. Please, consider fixing this and adding it to the list of possible rejection values in the returned promise
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @danielo515, I believe you are referring to the documentation of enableIndexedDbPersistence
or enableMultiTabIndexedDbPersistence
. If so, I agree that the documentation seems inconsistent with the implementation. I'm going to review this with the team and get back to you.
Hi @danielo515, I believe you are referring to the documentation of
enableIndexedDbPersistence
orenableMultiTabIndexedDbPersistence
. If so, I agree that the documentation seems inconsistent with the implementation. I'm going to review this with the team and get back to you.
Yes, that's correct, sorry for not being clear. Thank you
Hi @danielo515, I have moved this to the backlog for implementation in a future sprint. We will likely have to update the documentation to cover the current behavior, because changing the behavior would be a breaking change and could affect customers. Thanks for bringing it to our attention.
(b/241153576)