-
Notifications
You must be signed in to change notification settings - Fork 963
Closed
Labels
Description
[REQUIRED] Describe your environment
- Operating System version: Windows 10 (WSL 1)
- Browser version: Firefox 107.0.1
- Firebase SDK version: 9.14.0
- Firebase Product: firestore
[REQUIRED] Describe the problem
The javascript API reference indicates that getDocsFromCache
should return an error if the documents are not currently cached. See here.
However, while using getDocsFromCache
in a project today, I noticed it didn't throw any error when trying to get documents that weren't in cache. Instead it just returned the snapshot with size
0. It looks like this is intended behaviour according to this test, but does that align with the API reference? If you scroll up in that test file you'll see that getDocFromCache
(singular) is expected to fail when the doc is not in the cache. Let me know if I'm missing something.
Relevant Code:
Error is never thrown, even when documents aren't in cache
let snap;
try {
snap = await getDocsFromCache(ref);
} catch (error) { // error is never thrown, code in catch block never runs
console.log(error);
snap = await getDocs(ref);
}
snap.size === 0 // true