-
Notifications
You must be signed in to change notification settings - Fork 37
chore: adding better bootstrap support for react sdk #1194
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,12 +120,13 @@ export function createLDReactProvider( | |
| context: LDContext, | ||
| options?: LDReactProviderOptions, | ||
| ): React.FC<{ children: React.ReactNode }> { | ||
| const { deferInitialization, startOptions, reactContext, ldOptions } = options ?? {}; | ||
| const { deferInitialization, startOptions, reactContext, ldOptions, bootstrap } = options ?? {}; | ||
|
|
||
| const client = createClient(clientSideID, context, ldOptions); | ||
|
|
||
| if (!deferInitialization) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured if users are deferring start then they will need to provide their own start options. We may need to call this out in docs somewhere. |
||
| client.start(startOptions); | ||
| const effectiveStartOptions = bootstrap ? { ...startOptions, bootstrap } : startOptions; | ||
| client.start(effectiveStartOptions); | ||
| } | ||
|
Comment on lines
127
to
130
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Bootstrap data is silently discarded when When a user passes Was this helpful? React with 👍 or 👎 to provide feedback.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine as we should have it documented that if developers decide to defer initialization then they are responsible for starting the client however they want. |
||
|
|
||
| return createLDReactProviderWithClient(client, reactContext); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches https://github.com/launchdarkly/js-core/blob/main/packages/sdk/browser/src/LDClient.ts#L15