Skip to content

[Feat] WIP FS SSR serialization #8926

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DellaBitta
Copy link
Contributor

@DellaBitta DellaBitta commented Apr 15, 2025

Discussion

Do not merge. Work in progress feature branch to support the ability to resume onSnapshot listeners in the CSR phase based on serialized DataSnapshots and QuerySnapshots built in the SSR phase.

Testing

WIP

API Changes

WIP

DellaBitta and others added 3 commits April 1, 2025 15:23
…ure branch (#8872)

Merge the initial bundler implementation into the Firestore Result Serialization feature branch.
Implementation includes the ability to invoke `toJSON()` on `QuerySnapshot` and `DocumentSnapshot` instances.
…8896)

Pull request to add onSnapshot listeners support for bundles to the Firestore SSR serialization feature branch.

This change adds a series of onSnapshot overloads that match the existing onSnapshot variants (observer, individual callback functions, etc) but accepts a bundle instead of a QuerySnapshot or a DocumentSnapshot.

The toJSON methods of `QuerySnapshot` and `DocumentSnapshot` have also been updated to explicitly name the fields in the object return type.

Fixed an issue in the bundle builder where the bundleName for `DocumentSnapshots` didn't match the `ResourcePath` of the document, which is needed when reconstituting the `DocumentReference` in `onSnapshot`.

Finally, I cleaned up the text wrapping for the `onSnapshot` reference doc comments so they take up fewer lines of source code.
Copy link

changeset-bot bot commented Apr 15, 2025

⚠️ No Changeset found

Latest commit: c211ea2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 15, 2025

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser193 kB193 kB-8 B (-0.0%)
    cordova166 kB166 kB-8 B (-0.0%)
    main147 kB147 kB-8 B (-0.0%)
    module193 kB193 kB-8 B (-0.0%)
    react-native165 kB165 kB-8 B (-0.0%)
  • @firebase/auth-cordova

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser166 kB166 kB-8 B (-0.0%)
    module166 kB166 kB-8 B (-0.0%)
  • @firebase/auth-web-extension

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser142 kB142 kB-8 B (-0.0%)
    main159 kB159 kB-8 B (-0.0%)
    module142 kB142 kB-8 B (-0.0%)
  • @firebase/auth/internal

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser204 kB204 kB-8 B (-0.0%)
    main173 kB173 kB-8 B (-0.0%)
    module204 kB204 kB-8 B (-0.0%)
  • @firebase/firestore

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser384 kB394 kB+10.2 kB (+2.7%)
    main594 kB608 kB+14.1 kB (+2.4%)
    module384 kB394 kB+10.2 kB (+2.7%)
    react-native384 kB395 kB+10.2 kB (+2.7%)
  • @firebase/firestore-lite

    TypeBase (e055e90)Merge (6e492a9)Diff
    browser114 kB116 kB+2.55 kB (+2.2%)
    main157 kB160 kB+2.91 kB (+1.9%)
    module114 kB116 kB+2.55 kB (+2.2%)
    react-native114 kB116 kB+2.55 kB (+2.2%)
  • bundle

    16 size changes

    TypeBase (e055e90)Merge (6e492a9)Diff
    auth (EmailAndPassword)87.8 kB87.8 kB-8 B (-0.0%)
    firestore (CSI Auto Indexing Disable and Delete)274 kB281 kB+6.12 kB (+2.2%)
    firestore (CSI Auto Indexing Enable)274 kB281 kB+6.12 kB (+2.2%)
    firestore (Persistence)306 kB312 kB+6.12 kB (+2.0%)
    firestore (Query Cursors)251 kB259 kB+7.15 kB (+2.8%)
    firestore (Query)249 kB266 kB+16.4 kB (+6.6%)
    firestore (Read data once)237 kB248 kB+10.7 kB (+4.5%)
    firestore (Read Write w Persistence)330 kB337 kB+6.36 kB (+1.9%)
    firestore (Realtime updates)239 kB260 kB+20.7 kB (+8.7%)
    firestore (Transaction)216 kB225 kB+8.55 kB (+4.0%)
    firestore (Write data)216 kB219 kB+3.83 kB (+1.8%)
    firestore-lite (Query Cursors)104 kB106 kB+2.02 kB (+1.9%)
    firestore-lite (Query)101 kB103 kB+2.02 kB (+2.0%)
    firestore-lite (Read data once)75.9 kB78.1 kB+2.14 kB (+2.8%)
    firestore-lite (Transaction)101 kB103 kB+2.02 kB (+2.0%)
    firestore-lite (Write data)85.5 kB87.6 kB+2.02 kB (+2.4%)

  • firebase

    TypeBase (e055e90)Merge (6e492a9)Diff
    firebase-auth-compat.js141 kB141 kB-8 B (-0.0%)
    firebase-auth-cordova.js138 kB138 kB-8 B (-0.0%)
    firebase-auth-web-extension.js120 kB120 kB-8 B (-0.0%)
    firebase-auth.js158 kB158 kB-8 B (-0.0%)
    firebase-compat.js797 kB805 kB+8.50 kB (+1.1%)
    firebase-firestore-compat.js342 kB351 kB+8.51 kB (+2.5%)
    firebase-firestore-lite.js132 kB135 kB+2.55 kB (+1.9%)
    firebase-firestore.js443 kB453 kB+10.2 kB (+2.3%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/eIWldR0bhV.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 15, 2025

Size Analysis Report 1

This report is too large (1,081,524 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/rRSCgeRrhl.html

@DellaBitta DellaBitta changed the title [Feat] WIP Firestore Snapshot serialization [Feat] WIP FS SSR serialization Apr 15, 2025
commit 05338d8
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:58:18 2025 -0400

    test fixes

commit 28c6da9
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:39:22 2025 -0400

    update vector_value

commit 0aa81ce
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:39:11 2025 -0400

    update reference

commit e20bac9
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:24:50 2025 -0400

    update timestamp

commit 05b29c4
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:24:39 2025 -0400

    update geopoint

commit 4cf66f2
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 15:16:15 2025 -0400

    convert DocumentReference to new JSON validator.

commit 00a2423
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 13:44:27 2025 -0400

    format fix.

commit 09eb5cf
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 13:43:13 2025 -0400

    Bytes prototype.

commit b753f49
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 24 13:26:41 2025 -0400

    Linter doesn't like it, but API extractor does

commit 775cc69
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 17 13:13:52 2025 -0400

    lower case types

commit 188c86f
Author: DellaBitta <drsanta@google.com>
Date:   Thu Apr 17 10:41:58 2025 -0400

    DocumentReference unit and integration tests

commit 44d8045
Author: DellaBitta <drsanta@google.com>
Date:   Wed Apr 16 20:39:55 2025 -0400

    map Timestamp fields to DbTimestamp fields

commit f305182
Author: DellaBitta <drsanta@google.com>
Date:   Wed Apr 16 15:54:23 2025 -0400

    DocumentReference impl

commit 05a49aa
Author: DellaBitta <drsanta@google.com>
Date:   Wed Apr 16 11:14:00 2025 -0400

    Timestamp, GeoPoint, VectorValue

commit 1652e8b
Author: DellaBitta <drsanta@google.com>
Date:   Tue Apr 15 17:33:51 2025 -0400

    format

commit 8a081e1
Author: DellaBitta <drsanta@google.com>
Date:   Tue Apr 15 17:26:09 2025 -0400

    Bytes and VectorValue to/from JSON

commit 2a07791
Author: DellaBitta <drsanta@google.com>
Date:   Tue Apr 15 14:07:25 2025 -0400

    Bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants