Skip to content

fix: Honor urlBuilder on React Native EventSource reconnect#1420

Merged
kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-2461/rn-eventsource-url-builder
Jun 5, 2026
Merged

fix: Honor urlBuilder on React Native EventSource reconnect#1420
kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-2461/rn-eventsource-url-builder

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented Jun 4, 2026

Summary

The shared FDv2 streaming source (StreamingFDv2Base) passes a urlBuilder callback to requests.createEventSource so that every (re)connection recomputes the stream URL and replays the current basis selector. The browser SDK's DefaultBrowserEventSource honors this.

The React Native vendored EventSource (fromExternal/react-native-sse) did not:

  • it captured the URL once in its constructor and reused it on every reconnect, and
  • PlatformRequests.createEventSource never forwarded urlBuilder.

As a result, after an FDv2 stream reconnect the RN SDK sent an empty basis instead of the previously-known selector. This caused the streaming/fdv2/reconnection state management/{saves,replaces,updates} previously known state contract tests to fail on React Native (the browser SDK passes them).

This change threads urlBuilder through EventSourceOptions -> PlatformRequests.createEventSource -> the RN EventSource, which now recomputes _url from urlBuilder on each _open() -- mirroring the browser implementation.

Verified against sdk-test-harness v3.1.0-alpha.6 on an Android emulator: the three "previously known state" reconnection tests now pass. Added a unit test covering URL recomputation on reconnect.


Note

Low Risk
Targeted streaming reconnect behavior with browser parity; covered by a new unit test and existing contract scenarios.

Overview
React Native FDv2 streaming reconnects now recompute the SSE URL on every open, matching the browser SDK.

The vendored RN EventSource adds an optional urlBuilder on EventSourceOptions and invokes it in _open() before each initial and retry connection so dynamic query state (e.g. FDv2 basis) is replayed instead of the constructor URL being reused forever. PlatformRequests.createEventSource forwards eventSourceInitDict.urlBuilder into that implementation.

A unit test asserts urlBuilder runs on first connect and that a forced reconnect uses the updated URL (e.g. ?basis=initial).

Reviewed by Cursor Bugbot for commit f0230d4. Bugbot is set up for automated code reviews on this repo. Configure here.

The shared FDv2 streaming source passes a urlBuilder to createEventSource
so each (re)connection replays the current basis selector. The browser SDK
honors it, but the React Native EventSource captured the URL once and reused
it on reconnect, so FDv2 stream reconnects sent an empty basis. Thread
urlBuilder through EventSourceOptions, PlatformRequests, and the EventSource
so the URL is recomputed on each connection, matching the browser SDK.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26365 bytes
Compressed size limit: 29000
Uncompressed size: 129044 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38739 bytes
Compressed size limit: 39000
Uncompressed size: 212244 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179654 bytes
Compressed size limit: 200000
Uncompressed size: 831422 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31979 bytes
Compressed size limit: 34000
Uncompressed size: 114243 bytes

@kinyoklion kinyoklion marked this pull request as ready for review June 4, 2026 23:26
@kinyoklion kinyoklion requested a review from a team as a code owner June 4, 2026 23:26
@kinyoklion kinyoklion merged commit 93bd3f8 into main Jun 5, 2026
50 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-2461/rn-eventsource-url-builder branch June 5, 2026 15:37
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
joker23 pushed a commit that referenced this pull request Jun 5, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>akamai-edgeworker-sdk-common: 2.0.23</summary>

##
[2.0.23](akamai-edgeworker-sdk-common-v2.0.22...akamai-edgeworker-sdk-common-v2.0.23)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from ^2.19.0 to ^2.19.1
</details>

<details><summary>akamai-server-base-sdk: 3.0.24</summary>

##
[3.0.24](akamai-server-base-sdk-v3.0.23...akamai-server-base-sdk-v3.0.24)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.22 to
^2.0.23
    * @launchdarkly/js-server-sdk-common bumped from ^2.19.0 to ^2.19.1
</details>

<details><summary>akamai-server-edgekv-sdk: 1.4.26</summary>

##
[1.4.26](akamai-server-edgekv-sdk-v1.4.25...akamai-server-edgekv-sdk-v1.4.26)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.22 to
^2.0.23
    * @launchdarkly/js-server-sdk-common bumped from ^2.19.0 to ^2.19.1
</details>

<details><summary>browser: 0.1.26</summary>

##
[0.1.26](browser-v0.1.25...browser-v0.1.26)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk bumped from 4.8.0 to 4.8.1
</details>

<details><summary>client-testing-plugin: 0.1.0</summary>

##
[0.1.0](client-testing-plugin-v0.0.1...client-testing-plugin-v0.1.0)
(2026-06-05)


### ⚠ BREAKING CHANGES

* prerelease `@launchdarkly/client-testing-plugin`
([#1422](#1422))

### Features

* prerelease `@launchdarkly/client-testing-plugin`
([#1422](#1422))
([d801e9e](d801e9e))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.28.0 to 1.28.1
  * devDependencies
    * @launchdarkly/js-client-sdk bumped from 4.8.0 to 4.8.1
    * @launchdarkly/react-sdk bumped from 4.1.0 to 4.1.1
  * peerDependencies
    * @launchdarkly/js-client-sdk bumped from >=4.8.0 to >=4.8.1
    * @launchdarkly/react-sdk bumped from >=4.1.0 to >=4.1.1
</details>

<details><summary>cloudflare-server-sdk: 2.7.25</summary>

##
[2.7.25](cloudflare-server-sdk-v2.7.24...cloudflare-server-sdk-v2.7.25)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.6.21 to 2.6.22
</details>

<details><summary>fastly-server-sdk: 0.2.15</summary>

##
[0.2.15](fastly-server-sdk-v0.2.14...fastly-server-sdk-v0.2.15)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
</details>

<details><summary>jest: 1.0.21</summary>

##
[1.0.21](jest-v1.0.20...jest-v1.0.21)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/react-native-client-sdk bumped from ~10.18.0 to ~10.18.1
</details>

<details><summary>js-client-sdk: 4.8.1</summary>

##
[4.8.1](js-client-sdk-v4.8.0...js-client-sdk-v4.8.1)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.28.0 to 1.28.1
</details>

<details><summary>js-client-sdk-common: 1.28.1</summary>

##
[1.28.1](js-client-sdk-common-v1.28.0...js-client-sdk-common-v1.28.1)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.25.0 to 2.25.1
</details>

<details><summary>js-sdk-common: 2.25.1</summary>

##
[2.25.1](js-sdk-common-v2.25.0...js-sdk-common-v2.25.1)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))
</details>

<details><summary>js-server-sdk-common: 2.19.1</summary>

##
[2.19.1](js-server-sdk-common-v2.19.0...js-server-sdk-common-v2.19.1)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.25.0 to 2.25.1
</details>

<details><summary>js-server-sdk-common-edge: 2.6.22</summary>

##
[2.6.22](js-server-sdk-common-edge-v2.6.21...js-server-sdk-common-edge-v2.6.22)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
</details>

<details><summary>node-client-sdk: 0.0.3</summary>

##
[0.0.3](node-client-sdk-v0.0.2...node-client-sdk-v0.0.3)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped to 1.28.1
</details>

<details><summary>node-server-sdk: 9.11.2</summary>

##
[9.11.2](node-server-sdk-v9.11.1...node-server-sdk-v9.11.2)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
</details>

<details><summary>node-server-sdk-dynamodb: 6.2.30</summary>

##
[6.2.30](node-server-sdk-dynamodb-v6.2.29...node-server-sdk-dynamodb-v6.2.30)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.11.1 to 9.11.2
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.1 to >=9.11.2
</details>

<details><summary>node-server-sdk-otel: 1.3.17</summary>

##
[1.3.17](node-server-sdk-otel-v1.3.16...node-server-sdk-otel-v1.3.17)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.11.1 to 9.11.2
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.1 to >=9.11.2
</details>

<details><summary>node-server-sdk-redis: 4.2.29</summary>

##
[4.2.29](node-server-sdk-redis-v4.2.28...node-server-sdk-redis-v4.2.29)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.11.1 to 9.11.2
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from >=9.11.1 to >=9.11.2
</details>

<details><summary>openfeature-js-server-common: 0.1.3</summary>

##
[0.1.3](openfeature-js-server-common-v0.1.2...openfeature-js-server-common-v0.1.3)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.25.0 to 2.25.1
</details>

<details><summary>openfeature-node-server: 1.2.3</summary>

##
[1.2.3](openfeature-node-server-v1.2.2...openfeature-node-server-v1.2.3)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-sdk-common bumped from 2.25.0 to 2.25.1
* @launchdarkly/openfeature-js-server-common bumped from 0.1.2 to 0.1.3
  * devDependencies
    * @launchdarkly/node-server-sdk bumped from 9.11.1 to 9.11.2
  * peerDependencies
    * @launchdarkly/node-server-sdk bumped from 9.11.1 to 9.11.2
</details>

<details><summary>react-native-client-sdk: 10.18.1</summary>

##
[10.18.1](react-native-client-sdk-v10.18.0...react-native-client-sdk-v10.18.1)
(2026-06-05)


### Bug Fixes

* Honor urlBuilder on React Native EventSource reconnect
([#1420](#1420))
([93bd3f8](93bd3f8))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk-common bumped from 1.28.0 to 1.28.1
</details>

<details><summary>react-sdk: 4.1.1</summary>

##
[4.1.1](react-sdk-v4.1.0...react-sdk-v4.1.1)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-client-sdk bumped from ^4.8.0 to ^4.8.1
    * @launchdarkly/js-server-sdk-common bumped from ^2.19.0 to ^2.19.1
</details>

<details><summary>server-sdk-ai: 1.1.0</summary>

##
[1.1.0](server-sdk-ai-v1.0.1...server-sdk-ai-v1.1.0)
(2026-06-05)


### Features

* add region to model type
([#1423](#1423))
([7db5df5](7db5df5))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
  * peerDependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
</details>

<details><summary>server-sdk-ai-langchain: 0.8.2</summary>

##
[0.8.2](server-sdk-ai-langchain-v0.8.1...server-sdk-ai-langchain-v0.8.2)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
</details>

<details><summary>server-sdk-ai-openai: 0.7.2</summary>

##
[0.7.2](server-sdk-ai-openai-v0.7.1...server-sdk-ai-openai-v0.7.2)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
</details>

<details><summary>server-sdk-ai-vercel: 0.7.2</summary>

##
[0.7.2](server-sdk-ai-vercel-v0.7.1...server-sdk-ai-vercel-v0.7.2)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^1.0.1 to ^1.1.0
</details>

<details><summary>shopify-oxygen-sdk: 0.1.13</summary>

##
[0.1.13](shopify-oxygen-sdk-v0.1.12...shopify-oxygen-sdk-v0.1.13)
(2026-06-05)


### Bug Fixes

* explicit return types and TS6 source compatibility fixes
([#1418](#1418))
([9c131a2](9c131a2))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/js-server-sdk-common bumped from 2.19.0 to 2.19.1
</details>

<details><summary>vercel-server-sdk: 1.3.48</summary>

##
[1.3.48](vercel-server-sdk-v1.3.47...vercel-server-sdk-v1.3.48)
(2026-06-05)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.6.21 to 2.6.22
</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**
> The PR is mostly version and changelog metadata; user-visible risk is
limited to the documented RN reconnect fix, AI model `region` typing,
and the breaking client-testing-plugin prerelease bump.
> 
> **Overview**
> This is an automated **Release Please** cut that bumps versions across
the js-core monorepo (manifest, `package.json`,
`x-release-please-version` stamps, changelogs, and example app pins).
> 
> **Substantive releases bundled in this cut** (from changelog entries,
not re-implemented in this diff):
> 
> - **`@launchdarkly/js-sdk-common` /
`@launchdarkly/js-server-sdk-common` (patch):** explicit return types
and TypeScript 6 source compatibility
([#1418](#1418)),
propagated to edge/server wrappers (Fastly, Shopify Oxygen, Akamai
common, etc.).
> - **`@launchdarkly/server-sdk-ai` 1.1.0:** optional **`region`** on
the model config type
([#1423](#1423)); AI
provider packages bump their `server-sdk-ai` peer/dev deps to `^1.1.0`.
> - **`@launchdarkly/react-native-client-sdk` 10.18.1:** EventSource
**reconnect** now re-invokes **`urlBuilder`** so URLs (e.g. FDv2
`basis`) stay correct after retry
([#1420](#1420)).
> - **`@launchdarkly/client-testing-plugin` 0.1.0:** marked **breaking**
prerelease for the debug-override testing plugin
([#1422](#1422)).
> 
> Everything else in the diff is cascading patch/minor version and
dependency alignment (browser, node-server, stores, otel, OpenFeature,
etc.).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7189392. 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants