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

SSR related improvements for RC client SDK. #8699

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

SSR related improvements for RC client SDK. #8699

wants to merge 16 commits into from

Conversation

kjelko
Copy link

@kjelko kjelko commented Jan 9, 2025

SSR related improvements for RC client SDK.

  • Exposes an initialFetchResponse arg that pre-hydrates the client SDK state
  • Adds an argument that allows setting an alternate template ID to fetch from
  • Splits storage impls into a simple in-memory version that can be run in SSR contexts
  • Adds some basic tests for the API functions, which were previously untested

@kjelko kjelko requested review from a team and erikeldridge as code owners January 9, 2025 16:32
Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: 221d659

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

This PR includes changesets to release 3 packages
Name Type
@firebase/remote-config Minor
firebase Minor
@firebase/remote-config-compat Patch

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

@kjelko kjelko requested a review from ashish-kothari January 9, 2025 16:32
@kjelko kjelko changed the title Kjelko/rc js SSR related improvements for RC client SDK. Jan 9, 2025
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 9, 2025

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (645487b)Merge (736c452)Diff
    browser18.4 kB19.2 kB+846 B (+4.6%)
    main19.3 kB20.1 kB+838 B (+4.4%)
    module18.4 kB19.2 kB+846 B (+4.6%)
  • @firebase/auth

    TypeBase (645487b)Merge (736c452)Diff
    browser188 kB188 kB+107 B (+0.1%)
    cordova164 kB164 kB+107 B (+0.1%)
    main145 kB145 kB+111 B (+0.1%)
    module188 kB188 kB+107 B (+0.1%)
    react-native163 kB163 kB+113 B (+0.1%)
  • @firebase/auth-cordova

    TypeBase (645487b)Merge (736c452)Diff
    browser164 kB164 kB+107 B (+0.1%)
    module164 kB164 kB+107 B (+0.1%)
  • @firebase/auth-web-extension

    TypeBase (645487b)Merge (736c452)Diff
    browser140 kB140 kB+107 B (+0.1%)
    main157 kB157 kB+113 B (+0.1%)
    module140 kB140 kB+107 B (+0.1%)
  • @firebase/auth/internal

    TypeBase (645487b)Merge (736c452)Diff
    browser199 kB199 kB+107 B (+0.1%)
    main171 kB171 kB+113 B (+0.1%)
    module199 kB199 kB+107 B (+0.1%)
  • @firebase/data-connect

    TypeBase (645487b)Merge (736c452)Diff
    browser20.2 kB20.3 kB+32 B (+0.2%)
    main22.1 kB22.2 kB+23 B (+0.1%)
    module20.2 kB20.3 kB+32 B (+0.2%)
  • @firebase/database

    TypeBase (645487b)Merge (736c452)Diff
    browser249 kB249 kB+332 B (+0.1%)
    main254 kB254 kB+325 B (+0.1%)
    module249 kB249 kB+332 B (+0.1%)
  • @firebase/database-compat/standalone

    TypeBase (645487b)Merge (736c452)Diff
    main340 kB365 kB+25.9 kB (+7.6%)
  • @firebase/firestore

    TypeBase (645487b)Merge (736c452)Diff
    browser382 kB380 kB-1.67 kB (-0.4%)
    main589 kB589 kB+270 B (+0.0%)
    module382 kB380 kB-1.67 kB (-0.4%)
    react-native382 kB380 kB-1.66 kB (-0.4%)
  • @firebase/firestore-lite

    TypeBase (645487b)Merge (736c452)Diff
    browser111 kB112 kB+222 B (+0.2%)
    main154 kB154 kB+269 B (+0.2%)
    module111 kB112 kB+222 B (+0.2%)
    react-native112 kB112 kB+234 B (+0.2%)
  • @firebase/functions

    TypeBase (645487b)Merge (736c452)Diff
    browser13.7 kB14.0 kB+313 B (+2.3%)
    main14.2 kB14.6 kB+306 B (+2.1%)
    module13.7 kB14.0 kB+313 B (+2.3%)
  • @firebase/performance

    TypeBase (645487b)Merge (736c452)Diff
    browser29.1 kB30.6 kB+1.51 kB (+5.2%)
    main29.5 kB31.1 kB+1.56 kB (+5.3%)
    module29.1 kB30.6 kB+1.51 kB (+5.2%)
  • @firebase/remote-config

    TypeBase (645487b)Merge (736c452)Diff
    browser21.7 kB23.2 kB+1.51 kB (+7.0%)
    main22.9 kB24.4 kB+1.51 kB (+6.6%)
    module21.7 kB23.2 kB+1.51 kB (+7.0%)
  • @firebase/storage

    TypeBase (645487b)Merge (736c452)Diff
    browser57.8 kB58.0 kB+128 B (+0.2%)
    main59.3 kB59.4 kB+111 B (+0.2%)
    module57.8 kB58.0 kB+128 B (+0.2%)
  • @firebase/vertexai

    TypeBase (645487b)Merge (736c452)Diff
    browser28.8 kB29.0 kB+220 B (+0.8%)
    main29.6 kB29.9 kB+203 B (+0.7%)
    module28.8 kB29.0 kB+220 B (+0.8%)
  • bundle

    41 size changes

    TypeBase (645487b)Merge (736c452)Diff
    auth (Anonymous)76.2 kB76.4 kB+130 B (+0.2%)
    auth (EmailAndPassword)86.4 kB86.5 kB+130 B (+0.2%)
    auth (GoogleFBTwitterGitHubPopup)103 kB103 kB+130 B (+0.1%)
    auth (GooglePopup)100 kB100 kB+130 B (+0.1%)
    auth (GoogleRedirect)100 kB101 kB+130 B (+0.1%)
    auth (Phone)93.8 kB93.9 kB+130 B (+0.1%)
    database (Append to a list of data)149 kB149 kB+372 B (+0.2%)
    database (Filtering data)148 kB148 kB+372 B (+0.3%)
    database (Listen for child events)164 kB165 kB+372 B (+0.2%)
    database (Listen for value events + Detach listeners)164 kB165 kB+372 B (+0.2%)
    database (Listen for value events)164 kB165 kB+372 B (+0.2%)
    database (Read data once)164 kB164 kB+372 B (+0.2%)
    database (Save data as transactions)166 kB167 kB+372 B (+0.2%)
    database (Sort data)150 kB150 kB+372 B (+0.2%)
    database (Write data)148 kB149 kB+372 B (+0.3%)
    firestore (CSI Auto Indexing Disable and Delete)272 kB271 kB-1.32 kB (-0.5%)
    firestore (CSI Auto Indexing Enable)272 kB271 kB-1.32 kB (-0.5%)
    firestore (Persistence)304 kB302 kB-1.48 kB (-0.5%)
    firestore (Query Cursors)249 kB249 kB+98 B (+0.0%)
    firestore (Query)247 kB247 kB+98 B (+0.0%)
    firestore (Read data once)235 kB235 kB+83 B (+0.0%)
    firestore (Read Write w Persistence)328 kB327 kB-1.58 kB (-0.5%)
    firestore (Realtime updates)237 kB237 kB+83 B (+0.0%)
    firestore (Transaction)214 kB214 kB+157 B (+0.1%)
    firestore (Write data)213 kB214 kB+130 B (+0.1%)
    firestore-lite (Query Cursors)103 kB103 kB+224 B (+0.2%)
    firestore-lite (Query)98.8 kB99.1 kB+242 B (+0.2%)
    firestore-lite (Read data once)74.3 kB74.5 kB+223 B (+0.3%)
    firestore-lite (Transaction)99.5 kB99.8 kB+243 B (+0.2%)
    firestore-lite (Write data)83.9 kB84.1 kB+220 B (+0.3%)
    functions (call)34.4 kB34.7 kB+318 B (+0.9%)
    performance (trace)51.8 kB62.3 kB+10.5 kB (+20.2%)
    remote-config (getAndFetch)47.5 kB48.7 kB+1.13 kB (+2.4%)
    storage (getBytes)42.1 kB42.3 kB+175 B (+0.4%)
    storage (getDownloadURL)44.2 kB44.4 kB+175 B (+0.4%)
    storage (getMetadata)43.6 kB43.8 kB+175 B (+0.4%)
    storage (list + listAll)43.1 kB43.2 kB+175 B (+0.4%)
    storage (updateMetadata)43.9 kB44.1 kB+175 B (+0.4%)
    storage (uploadBytes)48.8 kB48.9 kB+175 B (+0.4%)
    storage (uploadBytesResumable)58.7 kB58.9 kB+175 B (+0.3%)
    storage (uploadString)49.0 kB49.1 kB+175 B (+0.4%)

  • firebase

    28 size changes

    TypeBase (645487b)Merge (736c452)Diff
    firebase-analytics.js29.8 kB29.7 kB-22 B (-0.1%)
    firebase-app-check.js24.9 kB24.9 kB-3 B (-0.0%)
    firebase-app-compat.js31.8 kB32.3 kB+552 B (+1.7%)
    firebase-app.js101 kB102 kB+1.43 kB (+1.4%)
    firebase-auth-compat.js143 kB143 kB+109 B (+0.1%)
    firebase-auth-cordova.js136 kB136 kB+76 B (+0.1%)
    firebase-auth-web-extension.js119 kB119 kB+59 B (+0.0%)
    firebase-auth.js155 kB155 kB-43 B (-0.0%)
    firebase-compat.js798 kB808 kB+9.96 kB (+1.2%)
    firebase-data-connect.js16.7 kB16.8 kB+1 B (+0.0%)
    firebase-database-compat.js166 kB166 kB+305 B (+0.2%)
    firebase-database.js186 kB187 kB+250 B (+0.1%)
    firebase-firestore-compat.js347 kB345 kB-1.77 kB (-0.5%)
    firebase-firestore-lite.js130 kB130 kB+218 B (+0.2%)
    firebase-firestore.js441 kB439 kB-1.75 kB (-0.4%)
    firebase-functions-compat.js10.4 kB10.6 kB+231 B (+2.2%)
    firebase-functions.js14.6 kB14.8 kB+200 B (+1.4%)
    firebase-installations.js15.2 kB15.2 kB+8 B (+0.1%)
    firebase-messaging-sw.js30.1 kB30.1 kB-29 B (-0.1%)
    firebase-messaging.js29.1 kB29.1 kB-34 B (-0.1%)
    firebase-performance-compat.js30.8 kB40.9 kB+10.1 kB (+32.7%)
    firebase-performance-standalone-compat.js93.7 kB105 kB+11.1 kB (+11.8%)
    firebase-performance.js35.1 kB45.5 kB+10.4 kB (+29.6%)
    firebase-remote-config-compat.js28.4 kB28.8 kB+435 B (+1.5%)
    firebase-remote-config.js31.3 kB32.7 kB+1.40 kB (+4.5%)
    firebase-storage-compat.js40.3 kB40.4 kB+109 B (+0.3%)
    firebase-storage.js46.2 kB46.3 kB+81 B (+0.2%)
    firebase-vertexai.js23.8 kB24.0 kB+163 B (+0.7%)

Test Logs

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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 9, 2025

Size Analysis Report 1

This report is too large (779,027 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/rwMEeG8Aam.html

@kjelko kjelko requested review from a team as code owners January 9, 2025 19:12
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

Copy link
Contributor

@DellaBitta DellaBitta left a comment

Choose a reason for hiding this comment

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

It seems thatFetchResponse isn't an exported type currently. It lives in src/client/remote_config_fetch_client.ts but it should be moved to src/public_types.ts and that should export it.

Copy link
Contributor

@ashish-kothari ashish-kothari left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@jenh jenh left a comment

Choose a reason for hiding this comment

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

A few interface links are dropping out of the devsite docs, but otherwise LGTM.

packages/remote-config/src/public_types.ts Outdated Show resolved Hide resolved
packages/remote-config/src/public_types.ts Outdated Show resolved Hide resolved
Copy link

@jenh jenh left a comment

Choose a reason for hiding this comment

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

(Missed a few things, thanks to @egilmorez for the assist!)

packages/remote-config/src/api.ts Outdated Show resolved Hide resolved
packages/remote-config/src/api.ts Outdated Show resolved Hide resolved
@kjelko kjelko requested a review from jenh January 22, 2025 20:10
Copy link
Contributor

@DellaBitta DellaBitta left a comment

Choose a reason for hiding this comment

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

One more change from my end, then waiting on @jamesdaniels' testing for final merge approval.

@@ -41,10 +42,40 @@ import { getModularInstance } from '@firebase/util';
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a @param here for RemoteConfigOptions

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.

5 participants