docs: clarify options prop requirement for Pages Router SSR with serverState
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 55/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- next.js, typescript
調査の方向性
リンク先のURLにあるPages Router SSRのドキュメントから始め、react.tsxの8-13行目と35-54行目を読んで、FlagsmithProviderの初期化契約を確認してください。serverState、options prop、preventFetch、およびmanual-initの結果を扱うように、例と説明用の注記を更新してください。完了は、一覧にある受け入れ基準によって定義されます。
索引モデルが issue の本文から書いたものです。
説明
Description
Problem
The current Next.js Pages Router SSR documentation example shows how to use serverState but doesn't mention that the options prop is required for automatic client-side initialization.
This leads to a common issue where developers following the docs experience:
useFlagsmithLoading()stuck on{ isLoading: true, isFetching: true }- Loading states never updating
- Confusion about why hooks don't work as expected
Root Cause
The FlagsmithProvider component has an intentional design contract:
// From react.tsx type definition
options?: Parameters<IFlagsmith['init']>[0] // Initialisation options, if you do not provide this you will have to call init manually
- Without
options: Users must callflagsmith.init()manually - With
options: Component automatically callsinit()on mount
This design is intentional but not documented in the Pages Router example.
Current Documentation Gap
The current example shows:
<FlagsmithProvider
flagsmith={flagsmithRef.current}
serverState={flagsmithState}
>
<Component {...pageProps} />
</FlagsmithProvider>
Issue: This works for rendering flags, but hooks like useFlagsmithLoading() will be stuck because init() was never called to register callbacks.
What Needs to Be Documented
The documentation should clearly explain:
- The
optionsprop is required for automatic client-side initialization - When using
serverState, you should passoptions={{ preventFetch: true }} - Why
preventFetch: trueis recommended (avoids duplicate API calls, uses server-side flags) - What happens without
options(hooks won't work, manualinit()required)
Suggested Fix
Update the Pages Router documentation example to:
- Include
options={{ preventFetch: true }}in the code example - Add a callout/note explaining why it's needed for hooks to work
- Explain the consequence of omitting it (stuck loading states)
Note: The code already has a comment in the type definition (react.tsx:10), but the documentation doesn't reflect this requirement.
Additional Context
User Impact
This affects developers:
- Following the Pages Router SSR documentation
- Using
useFlagsmithLoading()or other hooks - New to Flagsmith (not familiar with the initialization contract)
Customer Report
A customer recently reported this exact issue:
- Using Next.js 15 Pages Router
- Following the docs exactly as written
useFlagsmithLoading()stuck on loading state- Adding
options={{ preventFetch: true }}immediately fixed it
Reproduction
I've created a minimal reproduction project that demonstrates:
- The issue when
optionsis omitted - The fix when
options={{ preventFetch: true }}is added
Acceptance Criteria
- Pages Router example updated to include
options={{ preventFetch: true }} - Clear note/callout added explaining why
optionsis required - Documentation explains what happens without the
optionsprop
Related Code
- Component type definition:
react.tsx:8-13 - Initialization logic:
react.tsx:35-54
- 主要言語
- TypeScript
- スター
- 67
- フォーク
- 47
- 平均マージ
- 2時間 26分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Flagsmith/flagsmith-js-client のほかの issue
-
Dependency Dashboardオープン
難易度 1/5 1時間未満 初心者へのやさしさ 20/100
Flagsmith/flagsmith-js-client#435 ·
メンテナーはふだん 1 日以内に返信
-
Move module-scope Emitter in react.tsx into the Provider対応中かも @EngineerOnTravel が 72 日前に担当しました。 オープンbug good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
Flagsmith/flagsmith-js-client#391 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Flagsmith/flagsmith-js-client#330 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
Flagsmith/flagsmith-js-client#329 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Flagsmith/flagsmith-js-client#324 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
Flagsmith/flagsmith-js-client の issue をすべて見る
似ている issue
-
Parallel reticle_verify opens per-flow leases without the source lease's ignoreHTTPSErrors対応中かも @as992949791 が今日担当しました。 オープンgood first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
reticlehq/reticle#2033 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:quality p3-medium ready-for-agent type:docs
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
fderuiter/deruiter.dev#3589 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
manfredsteyer/angular-oauth2-oidc#1514 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
marmelab/react-admin#11431 ·
メンテナーはふだん 1 日以内に返信