Skip to content

feat: adding isomorphic provider to bridge client and server#1218

Merged
joker23 merged 12 commits intomainfrom
skz/sdk-2043/rsc-bootstrap
Apr 1, 2026
Merged

feat: adding isomorphic provider to bridge client and server#1218
joker23 merged 12 commits intomainfrom
skz/sdk-2043/rsc-bootstrap

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Mar 24, 2026

SDK-1946

  • modify the server-only example to demonstrate how to use the isomorphic provider
  • modify the bundling so client and server can still bundle correcly with isomorphic components
  • refactor the client side NOOP client to be able to execute well during SSR

Note

Medium Risk
Adds new server/client bridge components and changes SSR/noop-client initialization semantics, which can affect hydration and initial flag state in React Server Components apps. Also adjusts build configuration to avoid bundling issues between server and client entrypoints.

Overview
Introduces an isomorphic provider path for React Server Components: LDIsomorphicProvider (server component) computes bootstrap data via session.allFlagsState({ clientSideOnly: true }).toJSON() and renders a new 'use client' LDIsomorphicClientProvider that initializes the browser SDK with that bootstrap.

Updates the SSR createNoopClient stub to always report getInitializationState() as 'initializing' (while still treating presence of bootstrap as isReady()), and adds coverage for the new providers plus updated noop-client expectations.

Refreshes the server-only example and migration docs to demonstrate server-evaluated flag bootstrap (adds required LAUNCHDARKLY_CLIENT_SIDE_ID, a client component using useBoolVariation, and updated e2e assertion), and tweaks packaging (tsup/tsconfig path mapping + server bundle external) so the server entry can reference the client package without bundling conflicts.

Written by Cursor Bugbot for commit 9fa80fd. This will update automatically on new commits. Configure here.


Open with Devin

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25661 bytes
Compressed size limit: 29000
Uncompressed size: 126143 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179253 bytes
Compressed size limit: 200000
Uncompressed size: 828804 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31446 bytes
Compressed size limit: 34000
Uncompressed size: 111621 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 37015 bytes
Compressed size limit: 38000
Uncompressed size: 202741 bytes

* We provided the optional bootstrap data that will be applied to the client-side SDK.
* Learn more about bootstrap data in the [LaunchDarkly documentation](https://launchdarkly.com/docs/sdk/features/bootstrapping).
*
* **NOTE:** The client will also ad-hoc evaluate the flags on the server-side from bootstrap data.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thoughts on this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In general, I think this example name should be changed to something like react-server-example. Might want to do this in a separate change since that could add a lot of distracting changes.

@joker23 joker23 force-pushed the skz/sdk-2043/rsc-bootstrap branch 6 times, most recently from 247bed3 to 4613301 Compare March 25, 2026 17:18
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Mar 25, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23 joker23 force-pushed the skz/sdk-2043/rsc-bootstrap branch 2 times, most recently from 8ae5305 to 2027d95 Compare March 25, 2026 17:36
* When provided, the client immediately uses these values before the first network
* response arrives — eliminating the flag-fetch waterfall on page load.
*/
bootstrap: unknown;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The typing here is to be consistent with browser sdk

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Mar 25, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23 joker23 force-pushed the skz/sdk-2043/rsc-bootstrap branch 3 times, most recently from 153d31a to e79ea73 Compare March 30, 2026 18:48
@joker23 joker23 marked this pull request as ready for review March 31, 2026 20:56
@joker23 joker23 requested a review from a team as a code owner March 31, 2026 20:56
devin-ai-integration[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

joker23 added 10 commits April 1, 2026 08:49
This commit will also:
- modify the server-only example to demonstrate how to use the isomorphic provider
- modify the bundling so client and server can still bundle correcly with isomorphic components
- refactor the client side NOOP client to be able to execute well during SSR
@joker23 joker23 force-pushed the skz/sdk-2043/rsc-bootstrap branch from 64013be to 71795a3 Compare April 1, 2026 13:49
@joker23 joker23 force-pushed the skz/sdk-2043/rsc-bootstrap branch from fc278c0 to 0f76c59 Compare April 1, 2026 15:52
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@joker23 joker23 merged commit d766f39 into main Apr 1, 2026
43 checks passed
@joker23 joker23 deleted the skz/sdk-2043/rsc-bootstrap branch April 1, 2026 17:39
@github-actions github-actions bot mentioned this pull request Apr 1, 2026
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