You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: adding start() method to common client sdk package (#1244)
This PR will consolidate the `start()` method into the shared client sdk
package.
To do this we also:
- introduce an internal option called `requiresStart` which should be
`true` for new SDKs (and only RN has it default `false`)
- `requiresStart` is, effectively, a feature flag for whether the SDK is
using the new `create` + `start` initialization pattern
- consolidated the unit tests for the `start` method into client common
- moved `start` method out of browser and electron sdks
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches core initialization/identify behavior across multiple SDKs and
changes when bootstrap parsing and goal tracking occur, which could
affect startup sequencing and existing integrations if edge cases
regress.
>
> **Overview**
> Moves the `start()` implementation (including bootstrap flag
preloading and init promise caching/timeout behavior) from the Browser
and Electron SDKs into the shared `packages/shared/sdk-client`
`LDClientImpl`.
>
> Introduces `LDStartOptions` in the shared API and adds internal
options `requiresStart` and `initialContext` so platform SDKs can
enforce the new create+`start()` initialization pattern;
`identifyResult()` now blocks pre-`start()` calls when `requiresStart`
is enabled and updates the logged error message.
>
> Updates Browser/Electron wrappers and tests accordingly
(Browser/Electron remove their custom `start()` logic, Browser ensures
goal tracking only starts after `start()`), and adds a consolidated
`LDClientImpl.start()` test suite in the shared package.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5c9e61f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/launchdarkly/js-core/pull/1244"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
---------
Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
0 commit comments