Skip to content

Firestore: Re-write sample code in FirestoreDataConverter docs #7673

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

Merged
merged 13 commits into from
Dec 12, 2023

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Oct 3, 2023

Re-write the sample code for FirestoreDataConverter. The old sample had blatant syntax errors and was lacking in its demonstration of the power of type converters.

This improvements was ported to the nodejs-firestore repository in googleapis/nodejs-firestore#1958.

Fixes: #7671

@dconeybe dconeybe self-assigned this Oct 3, 2023
@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2023

🦋 Changeset detected

Latest commit: 14c249b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

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

Not sure what this means? Click here to learn what changesets are.

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 3, 2023

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (03ba262)Merge (d07fb30)Diff
    browser374 kB374 kB+95 B (+0.0%)
    esm5360 kB360 kB+299 B (+0.1%)
    main576 kB576 kB+169 B (+0.0%)
    module374 kB374 kB+95 B (+0.0%)
    react-native374 kB375 kB+95 B (+0.0%)
  • @firebase/firestore-lite

    TypeBase (03ba262)Merge (d07fb30)Diff
    browser109 kB109 kB+41 B (+0.0%)
    esm5106 kB106 kB+63 B (+0.1%)
    main150 kB150 kB+41 B (+0.0%)
    module109 kB109 kB+41 B (+0.0%)
    react-native109 kB109 kB+41 B (+0.0%)
  • bundle

    12 size changes

    TypeBase (03ba262)Merge (d07fb30)Diff
    firestore (Persistence)302 kB302 kB+95 B (+0.0%)
    firestore (Query Cursors)238 kB238 kB+95 B (+0.0%)
    firestore (Query)236 kB236 kB+95 B (+0.0%)
    firestore (Read data once)224 kB224 kB+95 B (+0.0%)
    firestore (Realtime updates)226 kB226 kB+95 B (+0.0%)
    firestore (Transaction)204 kB204 kB+95 B (+0.0%)
    firestore (Write data)204 kB204 kB+95 B (+0.0%)
    firestore-lite (Query Cursors)89.1 kB89.1 kB+41 B (+0.0%)
    firestore-lite (Query)85.2 kB85.3 kB+41 B (+0.0%)
    firestore-lite (Read data once)61.5 kB61.6 kB+41 B (+0.1%)
    firestore-lite (Transaction)86.4 kB86.4 kB+41 B (+0.0%)
    firestore-lite (Write data)71.1 kB71.1 kB+41 B (+0.1%)

  • firebase

    TypeBase (03ba262)Merge (d07fb30)Diff
    firebase-compat.js779 kB779 kB+95 B (+0.0%)
    firebase-firestore-compat.js340 kB340 kB+95 B (+0.0%)
    firebase-firestore-lite.js116 kB116 kB+41 B (+0.0%)
    firebase-firestore.js434 kB434 kB+95 B (+0.0%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 3, 2023

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • addDoc

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size123 kB123 kB+95 B (+0.1%)
      size-with-ext-deps194 kB194 kB+95 B (+0.0%)
    • deleteDoc

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size114 kB114 kB+95 B (+0.1%)
      size-with-ext-deps185 kB185 kB+95 B (+0.1%)
    • disableNetwork

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size102 kB102 kB+95 B (+0.1%)
      size-with-ext-deps173 kB173 kB+95 B (+0.1%)
    • enableIndexedDbPersistence

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size186 kB186 kB+95 B (+0.1%)
      size-with-ext-deps258 kB258 kB+95 B (+0.0%)
    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size221 kB221 kB+95 B (+0.0%)
      size-with-ext-deps294 kB294 kB+95 B (+0.0%)
    • enableNetwork

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size102 kB102 kB+95 B (+0.1%)
      size-with-ext-deps173 kB173 kB+95 B (+0.1%)
    • executeWrite

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size113 kB113 kB+95 B (+0.1%)
      size-with-ext-deps184 kB184 kB+95 B (+0.1%)
    • getAggregateFromServer

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size109 kB110 kB+95 B (+0.1%)
      size-with-ext-deps180 kB180 kB+95 B (+0.1%)
    • getCountFromServer

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size110 kB110 kB+95 B (+0.1%)
      size-with-ext-deps180 kB180 kB+95 B (+0.1%)
    • getDoc

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size143 kB143 kB+95 B (+0.1%)
      size-with-ext-deps214 kB214 kB+95 B (+0.0%)
    • getDocFromServer

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size143 kB143 kB+95 B (+0.1%)
      size-with-ext-deps214 kB214 kB+95 B (+0.0%)
    • getDocs

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size145 kB145 kB+95 B (+0.1%)
      size-with-ext-deps215 kB215 kB+95 B (+0.0%)
    • getDocsFromServer

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size145 kB145 kB+95 B (+0.1%)
      size-with-ext-deps215 kB215 kB+95 B (+0.0%)
    • loadBundle

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size112 kB112 kB+95 B (+0.1%)
      size-with-ext-deps182 kB182 kB+95 B (+0.1%)
    • memoryLocalCache

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size99.4 kB99.5 kB+95 B (+0.1%)
      size-with-ext-deps170 kB170 kB+95 B (+0.1%)
    • onSnapshot

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size145 kB145 kB+95 B (+0.1%)
      size-with-ext-deps216 kB216 kB+95 B (+0.0%)
    • onSnapshotsInSync

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size135 kB135 kB+95 B (+0.1%)
      size-with-ext-deps205 kB206 kB+95 B (+0.0%)
    • persistentLocalCache

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size183 kB183 kB+95 B (+0.1%)
      size-with-ext-deps255 kB255 kB+95 B (+0.0%)
    • persistentMultipleTabManager

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size218 kB218 kB+95 B (+0.0%)
      size-with-ext-deps290 kB290 kB+95 B (+0.0%)
    • persistentSingleTabManager

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size182 kB183 kB+95 B (+0.1%)
      size-with-ext-deps254 kB255 kB+95 B (+0.0%)
    • runTransaction

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size123 kB123 kB+95 B (+0.1%)
      size-with-ext-deps194 kB194 kB+95 B (+0.0%)
    • setDoc

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size122 kB122 kB+95 B (+0.1%)
      size-with-ext-deps193 kB193 kB+95 B (+0.0%)
    • updateDoc

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size123 kB123 kB+95 B (+0.1%)
      size-with-ext-deps193 kB193 kB+95 B (+0.0%)
    • waitForPendingWrites

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size103 kB103 kB+95 B (+0.1%)
      size-with-ext-deps173 kB173 kB+95 B (+0.1%)
    • writeBatch

      Size

      TypeBase (03ba262)Merge (d07fb30)Diff
      size125 kB125 kB+95 B (+0.1%)
      size-with-ext-deps195 kB195 kB+95 B (+0.0%)

Test Logs

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

@MarkDuckworth MarkDuckworth marked this pull request as ready for review October 5, 2023 15:58
Copy link
Contributor Author

@dconeybe dconeybe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements! I've just left a few optional comments for you to consider. Otherwise, LGTM.

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dconeybe dconeybe requested a review from a team as a code owner December 11, 2023 16:42
Copy link
Contributor

Changeset File Check ⚠️

  • Warning: This PR modifies files in the following packages but they have not been included in the changeset file:%0A - @firebase/firestore%0A%0A Make sure this was intentional.

Copy link
Contributor

@MarkDuckworth MarkDuckworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dconeybe I addressed your feedback to my changes. I believe this PR is good to go.

@dconeybe dconeybe merged commit 42bfb0b into master Dec 12, 2023
@dconeybe dconeybe deleted the dconeybe/FirestoreDataConverterSampleCodeRewrite branch December 12, 2023 15:49
dconeybe added a commit to googleapis/nodejs-firestore that referenced this pull request Dec 12, 2023
The old sample had blatant syntax errors and was lacking in its demonstration of the power of type converters.

These changes are ported from firebase/firebase-js-sdk#7673
dconeybe added a commit to googleapis/nodejs-firestore that referenced this pull request Dec 12, 2023
The old sample had blatant syntax errors and was lacking in its demonstration of the power of type converters.

These changes are ported from firebase/firebase-js-sdk#7673
@firebase firebase locked and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FirestoreDataConverter example doesn't work.
5 participants