Skip to content
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

Loading data bundles in the client outdated docs #7755

Closed
marcusx2 opened this issue Nov 6, 2023 · 2 comments
Closed

Loading data bundles in the client outdated docs #7755

marcusx2 opened this issue Nov 6, 2023 · 2 comments

Comments

@marcusx2
Copy link

marcusx2 commented Nov 6, 2023

Operating System

macOS

Browser Version

Safari 16.5.2

Firebase SDK Version

10.5.0

Firebase SDK Product:

Firestore

Describe your project's tooling

index.html with source tag. Just javascript.

Describe the problem

The documentation regarding loading data bundles in the client is outdated. The code doesn't work, probably because it refers to the firebase v8 SDK.

Steps and code to reproduce issue

Here's an up-to-date version

const resp = await fetch('./bundle.txt');//assuming the bundle is in the same folder
await loadBundle(db, resp.body);
const query = await namedQuery(db, 'latest-stories-query');
const querySnapshot = await getDocs(query);
querySnapshot.forEach(doc => console.log(doc.id, " => ", doc.data()));

There is also no equivalent to the line const storiesSnap = await query.get({ source: 'cache' });, how would this be adapted to v9?

@marcusx2 marcusx2 added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Nov 6, 2023
@MarkDuckworth MarkDuckworth self-assigned this Nov 6, 2023
@MarkDuckworth MarkDuckworth added bug and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels Nov 6, 2023
@MarkDuckworth
Copy link
Contributor

@marcusx2, You're right, it looks like that page does not have a bundle loading snippet for the modular Web API. It only has a snippet for the v8/compat API. @morganchen12, can you help us get this doc page updated with a new sample for the modular web SDK? The code provided from @marcusx2 looks like a good starting point, I can provide anything else you need.

Regarding your second question:

There is also no equivalent to the line const storiesSnap = await query.get({ source: 'cache' });, how would this be adapted to v9?

You need getDocsFromCache().

@morganchen12
Copy link

This has been fixed in the docs.

@firebase firebase locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants