feat(js-client-sdk): add ability to customize storage impl#1404
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/browser size report |
|
@launchdarkly/js-client-sdk size report |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0b27576. Configure here.
kinyoklion
left a comment
There was a problem hiding this comment.
Should extend the 'logs no warnings when all configuration is valid' test with storage like the RN equivalent test.
🤖 I have created a release *beep* *boop* --- <details><summary>browser: 0.1.25</summary> ## [0.1.25](browser-v0.1.24...browser-v0.1.25) (2026-06-01) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk bumped from 4.7.3 to 4.8.0 </details> <details><summary>jest: 1.0.19</summary> ## [1.0.19](jest-v1.0.18...jest-v1.0.19) (2026-06-01) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/react-native-client-sdk bumped from ~10.17.7 to ~10.17.8 </details> <details><summary>js-client-sdk: 4.8.0</summary> ## [4.8.0](js-client-sdk-v4.7.3...js-client-sdk-v4.8.0) (2026-06-01) ### Features * **js-client-sdk:** add ability to customize storage impl ([#1404](#1404)) ([77864cb](77864cb)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.27.2 to 1.28.0 </details> <details><summary>js-client-sdk-common: 1.28.0</summary> ## [1.28.0](js-client-sdk-common-v1.27.2...js-client-sdk-common-v1.28.0) (2026-06-01) ### Features * **js-client-sdk:** add ability to customize storage impl ([#1404](#1404)) ([77864cb](77864cb)) </details> <details><summary>node-client-sdk: 0.0.2</summary> ## [0.0.2](node-client-sdk-v0.0.1...node-client-sdk-v0.0.2) (2026-06-01) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped to 1.28.0 </details> <details><summary>react-native-client-sdk: 10.17.8</summary> ## [10.17.8](react-native-client-sdk-v10.17.7...react-native-client-sdk-v10.17.8) (2026-06-01) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.27.2 to 1.28.0 </details> <details><summary>react-sdk: 4.1.0</summary> ## [4.1.0](react-sdk-v4.0.5...react-sdk-v4.1.0) (2026-06-01) ### Features * **js-client-sdk:** add ability to customize storage impl ([#1404](#1404)) ([77864cb](77864cb)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk bumped from ^4.7.3 to ^4.8.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > No application logic in the diff—only version manifests, changelogs, and dependency pins from automated release tooling. > > **Overview** > This is a **Release Please** cut that publishes the already-merged **customizable client storage** work from [#1404](#1404). The diff itself only bumps versions, updates `.release-please-manifest.json`, refreshes changelogs, and aligns workspace dependency pins and `x-release-please-version` stamps—no runtime source changes in this PR. > > **`@launchdarkly/js-client-sdk-common` 1.28.0** is the functional release (documented feature: pluggable storage). **`@launchdarkly/js-client-sdk` 4.8.0** and **`@launchdarkly/react-sdk` 4.1.0** pick that up and note the same feature in their changelogs. **React Native 10.17.8**, **combined browser 0.1.25**, **node-client-sdk 0.0.2**, and **jest tooling 1.0.19** are dependency-driven patch/minor bumps. Examples and internal packages are updated to the new SDK versions. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 87c075f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This PR will enable browser sdk to take in a custom storage implementation.
Additional details:
Note
Low Risk
Optional API with safe wrapper; default persistence path is unchanged when
storageis not set.Overview
Adds an optional
storagesetting on the browser (and React client) SDK so apps can plug in their own persistence instead ofwindow.localStorage, while keeping today’s default when the option is omitted.Shared client code introduces the
LDStoragecontract (get/set/clear) andcreateSafeStorage, which adapts custom implementations to the internal storage API: failures are logged, reads returnnull, and writes are dropped so a bad implementation cannot take down the host app. The browser client validatesstorage, wraps it withcreateSafeStorage, and passes it intoBrowserPlatform, which uses the override when provided and otherwise still choosesLocalStorageonly when supported.Reviewed by Cursor Bugbot for commit a1f4117. Bugbot is set up for automated code reviews on this repo. Configure here.