chore: update client-side JS SDK to @launchdarkly/js-client-sdk@4#38
Conversation
- Replace launchdarkly-js-client-sdk@3 with @launchdarkly/js-client-sdk@4 - Update client-side API from LDClient.initialize() to createClient()/start() - Move bootstrap option from createClient options to start() options - Remove unnecessary es6-promise and event-source-polyfill - Update Node.js engine requirement to >=18 Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
| const normalPromise = client.start(); | ||
| const bootstrapPromise = bootstrapClient.start({ bootstrap: window.ldBootstrap }); | ||
|
|
||
| const normalResult = await normalPromise; |
There was a problem hiding this comment.
We are still awaiting these in order, so it still doesn't demonstrate the purpose of bootstrap.
There was a problem hiding this comment.
Good catch — fixed. Now both start() calls fire immediately and each resolves independently via .then(), so the bootstrapped client renders as soon as its promise resolves without waiting for the normal client.
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
| document.querySelector(selector).innerHTML = JSON.stringify(targetClient.allFlags(), null, 2); | ||
| } | ||
|
|
||
| client.start(); |
There was a problem hiding this comment.
Please add .catch handlers on the starts.
There was a problem hiding this comment.
Added .catch(console.error) on both start() calls.
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Update the client-side JavaScript SDK from the legacy
launchdarkly-js-client-sdk@3to the current@launchdarkly/js-client-sdk@4.Changes:
launchdarkly-js-client-sdk@3CDN script with@launchdarkly/js-client-sdk@4ESM importLDClient.initialize()tocreateClient()+start()bootstrapoption fromcreateClient()options tostart()options (new SDK API)es6-promiseandevent-source-polyfillpolyfills16.13.1to>=18Tested locally — both normal and bootstrapped clients display flag values correctly with no console warnings.
Review & Testing Checklist for Human
npm install && npm startwith validLD_SDK_KEYandLD_CLIENTSIDE_IDand verify both normal and bootstrapped clients display flag valuesNotes
The server-side SDK (
@launchdarkly/node-server-sdk >= 8.0.0) was not changed — it already resolves to the latest version (9.11.0).Link to Devin session: https://app.devin.ai/sessions/b648d8cd5e0b4a04ba0cbf1dcd1a9886
Requested by: @kinyoklion