Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Dec 1, 2025

This PR will add a new browser SDK example that works with the new 4.x implementation.


Note

Adds a new browser example app demonstrating the JS client SDK, with build config and workspace inclusion.

  • Example app (packages/sdk/browser/example):
    • App logic: src/app.ts initializes @launchdarkly/js-client-sdk, identifies a user context, evaluates flagKey, updates UI on change/error.
    • Build/setup: package.json with tsdown build, tsconfig.json, tsdown.config.ts (browser bundling), index.html, index.css.
    • Docs: README.md with setup and run instructions.
  • Workspace:
    • Add packages/sdk/browser/example to root package.json workspaces.

Written by Cursor Bugbot for commit 580a21a. This will update automatically on new commits. Configure here.

@joker23 joker23 requested a review from a team as a code owner December 1, 2025 19:50
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25394 bytes
Compressed size limit: 26000
Uncompressed size: 124693 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

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

@joker23 joker23 force-pushed the skz/sdk-1649/create-javascript-example branch from cd49047 to 1048727 Compare December 1, 2025 19:58
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 22101 bytes
Compressed size limit: 25000
Uncompressed size: 76263 bytes

@joker23 joker23 force-pushed the skz/sdk-1649/create-javascript-example branch 2 times, most recently from 126daf7 to d701b99 Compare December 1, 2025 23:24
@joker23 joker23 force-pushed the skz/sdk-1649/create-javascript-example branch from 10632da to 580a21a Compare December 2, 2025 15:18

ldclient.identify(context).catch(() => {
div.replaceChild(document.createTextNode('Error identifying client'), div.firstChild as Node);
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: UI remains stuck when identify succeeds without flags

The identify call only has a .catch() handler without a .then() for the success case. The UI update relies entirely on the change event firing. However, the SDK only emits a change event when flag values differ from previous values. If no flags are configured in the LaunchDarkly project (or the server returns empty flags), identify succeeds but no change event fires, leaving the UI permanently stuck on "Initializing...". Adding a .then() handler that calls render() would ensure the UI updates after successful identification regardless of whether flags exist.

Fix in Cursor Fix in Web

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