Skip to content

Commit 894153d

Browse files
[FSSDK-12455] review update
1 parent dcc2563 commit 894153d

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This guide covers breaking changes and how to update your code when upgrading fr
1111
- [useDecision to useDecide](#usedecision-to-usedecide)
1212
- [useExperiment (removed)](#useexperiment-removed)
1313
- [useFeature (removed)](#usefeature-removed)
14-
- [useTrackEvent (removed)](#usetrackEvent-removed)
14+
- [useTrackEvent (removed)](#usetrackevent-removed)
1515
- [New hooks](#new-hooks)
1616
- [Accessing the client directly](#accessing-the-client-directly)
1717
- [Removed APIs](#removed-apis)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ _props_
221221
| `qualifiedSegments` | `string[]` | No | Pre-fetched ODP audience segments for the user. Use [`getQualifiedSegments`](#getqualifiedsegments) to obtain these segments server-side. |
222222
| `skipSegments` | `boolean` | No | When `true`, skips background ODP segment fetching. Default: `false`. |
223223

224-
> **Note:** `<OptimizelyProvider>` requires user data. If user information must be fetched asynchronously, resolve the promise before rendering the Provider.
224+
> **Note:** Unless VUID is enabled, `<OptimizelyProvider>` requires user data. If user information must be fetched asynchronously, resolve the promise before rendering the Provider.
225225
226226
### Readiness
227227

docs/nextjs-integration.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ The layout fetches the datafile, sets `globalThis` for the server render, and in
145145
// src/app/layout.tsx
146146
import { getDatafile } from '@/data/getDatafile';
147147

148-
export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
148+
export default async function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
149149
const datafile = await getDatafile();
150+
const serialized = JSON.stringify(datafile ?? '');
150151
// Set on globalThis so the provider module can read it during server rendering
151152
globalThis.__OPTIMIZELY_DATAFILE__ = datafile ?? '';
152153

@@ -155,7 +156,7 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
155156
<head>
156157
<script
157158
dangerouslySetInnerHTML={{
158-
__html: `globalThis.__OPTIMIZELY_DATAFILE__ = ${datafile};`,
159+
__html: `globalThis.__OPTIMIZELY_DATAFILE__ = ${serialized};`,
159160
}}
160161
/>
161162
</head>
@@ -175,12 +176,13 @@ import Document, { Html, Head, Main, NextScript } from 'next/document';
175176
import { getDatafile } from '@/data/getDatafile';
176177

177178
export default function MyDocument({ datafile }: { datafile: string }) {
179+
const serialized = JSON.stringify(datafile ?? '');
178180
return (
179181
<Html>
180182
<Head>
181183
<script
182184
dangerouslySetInnerHTML={{
183-
__html: `globalThis.__OPTIMIZELY_DATAFILE__ = ${datafile};`,
185+
__html: `globalThis.__OPTIMIZELY_DATAFILE__ = ${serialized};`,
184186
}}
185187
/>
186188
</Head>

0 commit comments

Comments
 (0)