[Feat] FS SSR serialization
Discussion
Support the ability to resume onSnapshot listeners in the CSR phase based on serialized DataSnapshots and QuerySnapshots built in the SSR phase. Allow Firestore result types to be serialized with toJSON and then deserialized with fromJSON methods on the objects.
DocumentSnapshot and QuerySnapshot deserialization methods will be standalone, tree-shakable functions dataSnapshotFromJSON and querySnapshotFromJSON.
Testing
Integration Tests. Unit Tests. Locally tested with Next.JS.
Will add to our Next.js End to End test suite when the change has been staged.
API Changes
Approved go/fs-js-json-serialization.
⚠️ No Changeset found
Latest commit: 67cd379305500e74758b3dd924a06fed6c0790a4
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
Size Report 1
Affected Products
@firebase/firestoreType Base (13e6cce) Merge (3503366) Diff browser 385 kB 395 kB +9.29 kB (+2.4%) main 596 kB 615 kB +19.5 kB (+3.3%) module 385 kB 395 kB +9.29 kB (+2.4%) react-native 386 kB 395 kB +9.29 kB (+2.4%) @firebase/firestore-liteType Base (13e6cce) Merge (3503366) Diff browser 114 kB 117 kB +2.56 kB (+2.2%) main 157 kB 160 kB +2.92 kB (+1.9%) module 114 kB 117 kB +2.56 kB (+2.2%) react-native 114 kB 117 kB +2.56 kB (+2.2%) bundle15 size changes
Type Base (13e6cce) Merge (3503366) Diff firestore (CSI Auto Indexing Disable and Delete) 280 kB 290 kB +10.3 kB (+3.7%) firestore (CSI Auto Indexing Enable) 280 kB 290 kB +10.3 kB (+3.7%) firestore (Persistence) 311 kB 321 kB +10.3 kB (+3.3%) firestore (Query Cursors) 256 kB 260 kB +3.71 kB (+1.4%) firestore (Query) 254 kB 258 kB +3.71 kB (+1.5%) firestore (Read data once) 242 kB 247 kB +5.63 kB (+2.3%) firestore (Read Write w Persistence) 336 kB 341 kB +5.50 kB (+1.6%) firestore (Realtime updates) 244 kB 248 kB +3.83 kB (+1.6%) firestore (Transaction) 221 kB 226 kB +5.50 kB (+2.5%) firestore (Write data) 220 kB 228 kB +7.12 kB (+3.2%) firestore-lite (Query Cursors) 109 kB 111 kB +2.03 kB (+1.9%) firestore-lite (Query) 105 kB 107 kB +2.03 kB (+1.9%) firestore-lite (Read data once) 80.6 kB 82.8 kB +2.16 kB (+2.7%) firestore-lite (Transaction) 106 kB 108 kB +2.03 kB (+1.9%) firestore-lite (Write data) 90.2 kB 92.3 kB +2.03 kB (+2.2%) firebaseType Base (13e6cce) Merge (3503366) Diff firebase-compat.js 802 kB 806 kB +3.61 kB (+0.4%) firebase-firestore-compat.js 347 kB 351 kB +3.60 kB (+1.0%) firebase-firestore-lite.js 137 kB 140 kB +2.56 kB (+1.9%) firebase-firestore.js 449 kB 458 kB +9.26 kB (+2.1%)
Test Logs