Skip to content

Provide a way to serialize Query (expose stringifyQuery for example) #6787

@GrandSchtroumpf

Description

@GrandSchtroumpf

[REQUIRED] Describe your environment

  • Operating System version: Windows 11
  • Browser version: EDGE 107.0.1418.42
  • Firebase SDK version: 9.14.0
  • Firebase Product: Firestore

[REQUIRED] Describe the problem

When hydrating (angular universal, next.js, ...) / resuming (qwik) the frontend, frameworks serialize the state of the application as a json object in the html. It works well for document & collection reference as we can use the path as a serializable reference, but not for Query. This leads to a flickering on the application if the page display data coming from a query.

Solution

Provide a way to serialize a query so it can be referenced in the backend & frontend the same way.
I saw in the code that there is a stringifyQuery that transforms a query into a string. If exposed, it would fix this issue. For example:

const ref = collection('collectionName');
const queryRef = query(ref, where('field', '==', value));
const key = stringifyQuery(queryRef);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions