Repository navigation
Conversation
Base automatically changed from
skz/sdk-3151/common-eventsource-node-consumers
to
main
October 30, 2026 22:34
joker23
added a commit
that referenced
this pull request
Oct 30, 2026
…2033) ## Summary Adds an opt-in `fetch()`-based `EventSource` to the browser SDK behind its own `@launchdarkly/js-client-sdk/fetch-eventsource` entry point, so neither the implementation nor its dependency reaches the default bundle. The native browser `EventSource` remains the default. Includes the `eventSource` factory option plumbing. The example app moved to #2139 to keep this diff smaller. The browser contract-test entity can be opened with `?eventsource=fetch`, which makes every client use the fetch-based `EventSource` and advertise the `client-use-post` and `client-event-source-http-errors` capabilities. CI runs the fetch entity against both harnesses. The v2 run (with `suppressions_fetch_eventsource.txt`) covers the FDv1 path, including `REPORT` streaming and the poll tags header tests; the stream tags assertions are skipped because the transport strips the tags header. The v3 run (with `suppressions_datamode_changes.txt`) covers the FDv2 path, including the `usePost` POST streaming variants. The transport does not send the `x-launchdarkly-tags` header. The streaming service's CORS allow-list does not include it, and the browser preflight would fail. Replaces #2034 and #2048, which GitHub auto-marked merged during a stack reorder; their bot-review history lives there. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Adds an optional **`@launchdarkly/js-client-sdk/fetch-eventsource`** subpath and **`eventSource`** client option so apps can stream with a **`fetch()`-based EventSource** instead of the native one, without pulling **`@launchdarkly/eventsource`** into the default bundle. **`BrowserRequests`** delegates creation to the configured factory and exposes **capabilities** (headers, custom method, read timeout) so **REPORT** / **POST** streaming can be enabled when the transport supports them; **`fetchBrowserEventSource`** strips **`x-launchdarkly-tags`** on stream requests to avoid CORS preflight failures. > > **CI and contract tests** restart the browser entity with **`?eventsource=fetch`**, run extra harness passes (FDv1/FDv2, native vs fetch), and split skip lists (**`suppressions_fetch_eventsource.txt`**, tightened **`suppressions_datamode_changes.txt`**). The entity advertises **`client-use-post`** and **`client-event-source-http-errors`** in fetch mode and maps **`usePost`** from harness config. > > **`StreamingFDv2Base`** now classifies status-less filter failures as network errors, dedupes filter vs **`onerror`** for the same event object, and adds tests for those paths. React CI switches contract-test installs to **`yarn workspaces focus`**. Package-config baselines cover the new export. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6b2eac2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
joker23
force-pushed
the
skz/sdk-3151/custom-eventsource-example
branch
from
October 30, 2026 22:34
652fbeb to
8a23d46
Compare
Contributor
|
@launchdarkly/js-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk size report |
joker23
marked this pull request as ready for review
October 30, 2026 22:48
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a vanilla-TypeScript browser example that demonstrates the injectable
eventSourceoption. The example passesfetchBrowserEventSource(from@launchdarkly/js-client-sdk/fetch-eventsource) so thatusePost: truetakes effect for the streaming connection, and enables the FDv2 data system.The example was split out of #2033 to reduce the review load there. This PR is stacked on #2033 and shows only the example diff; it retargets to
mainwhen #2033 merges. Besides the example directory, it adds the workspace entry in the rootpackage.jsonand the release-please version-pin entry for the example's SDK dependency.Note
Overview
Adds a new workspace
@launchdarkly/browser-example-custom-eventsourcethat shows how to wirefetchBrowserEventSourcefrom@launchdarkly/js-client-sdk/fetch-eventsourcewithusePost: trueand FDv2 (dataSystem: {}) so streaming uses POST instead of native GET-onlyEventSource.The example includes build/docs (
.env.template, README), a Playwright check that the flag evaluates to true and a POST hits/sdk/stream/eval, and tsdown bundling that inlines the fetch-eventsource subpath for a single script tag.Repo wiring: registers the path in the root
package.jsonworkspaces, adds a release-please pin for the example’s SDK dependency, and arun-custom-eventsource-examplejob in.github/workflows/browser.yml(same fork/OIDC guard as the existing browser example job).Reviewed by Cursor Bugbot for commit 09c0bed. Bugbot is set up for automated code reviews on this repo. Configure here.