Skip to content

[FSSDK-10777] SSR improvements + RSC support addition#318

Merged
junaed-optimizely merged 17 commits into3.x.xfrom
junaed/fssdk-10777-ssr-doc-update
Mar 6, 2026
Merged

[FSSDK-10777] SSR improvements + RSC support addition#318
junaed-optimizely merged 17 commits into3.x.xfrom
junaed/fssdk-10777-ssr-doc-update

Conversation

@junaed-optimizely
Copy link
Contributor

@junaed-optimizely junaed-optimizely commented Feb 25, 2026

Summary

  • Server-side bundle: Added a new server.ts entry point that can be safely imported in React Server Components (RSC) without client-only React APIs (createContext, hooks, etc.)
  • ODP Qualified Segments support: Added ability to pass qualifiedSegments through the OptimizelyProvider and setUser, allowing pre-fetched segments to be set synchronously before the SDK is ready — critical for SSR where async ODP fetches aren't viable
  • getQualifiedSegments utility: A standalone async function that parses the datafile for ODP config, extracts segment audience conditions, and queries the ODP GraphQL API — designed for use in server-side data fetching
  • Hook readiness logic: Improved useExperiment, useFeature, and useDecision hooks to check for both config and user context availability (including segments) before computing decisions, enabling correct SSR rendering without waiting for onReady
  • Refactored utils: Migrated utils.tsx → utils.ts (removing React dependency) so utilities can be shared between client and server entry points
  • Documentation: Added a comprehensive integration guide covering SSR, SSG, and App Router patterns
  • Build updates: Updated build config to produce the new server bundle

Test plan

Tests have been added to support new changes

Issues

  • FSSDK-10777

Copy link
Contributor

@raju-opti raju-opti left a comment

Choose a reason for hiding this comment

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

few comments

@junaed-optimizely junaed-optimizely changed the title Junaed/fssdk 10777 ssr doc update [FSSDK-10777] SSR improvements Mar 2, 2026
@junaed-optimizely junaed-optimizely changed the title [FSSDK-10777] SSR improvements [FSSDK-10777] SSR improvements + RSC support addition Mar 2, 2026
Copy link
Contributor

@raju-opti raju-opti left a comment

Choose a reason for hiding this comment

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

looks good. Few comments

Copy link
Contributor

@raju-opti raju-opti left a comment

Choose a reason for hiding this comment

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

Looks good. couple of small comments

@junaed-optimizely junaed-optimizely merged commit c23e1ef into 3.x.x Mar 6, 2026
1 check passed
@junaed-optimizely junaed-optimizely deleted the junaed/fssdk-10777-ssr-doc-update branch March 6, 2026 16:54
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