Skip to content

chore: adding camelcase flag keys to useFlags hook#1174

Open
joker23 wants to merge 5 commits intomainfrom
skz/sdk-2014/camel-case-flags
Open

chore: adding camelcase flag keys to useFlags hook#1174
joker23 wants to merge 5 commits intomainfrom
skz/sdk-2014/camel-case-flags

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Mar 11, 2026

depends on #1166


Note

Medium Risk
Changes the shape and key access semantics of the deprecated useFlags() return value (including key filtering and event emission behavior), which can break consumers relying on raw flag keys or $ keys. Scope is limited to deprecated hook and related client/options plumbing, but it impacts runtime flag access and analytics events via variation() calls.

Overview
useFlags() (deprecated hook) now returns camelCased flag keys by default, with an opt-out via useCamelCaseFlagKeys exposed on the client as shouldUseCamelCaseFlagKeys() (defaulting to true in createClient and the server noop client). The proxy maps camelCase property reads back to the original flag key when calling client.variation(), and filters out $ system keys from the returned object.

The hook also avoids an extra mount-time render by skipping a redundant setFlags on first effect run, and updates tests/utilities accordingly (new toCamelCase helper + expanded useFlags test coverage for proxy semantics, caching, change events, context changes, and custom contexts).

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


Open with Devin

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

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

@github-actions
Copy link
Contributor

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

@joker23 joker23 changed the title skz/sdk 2014/camel case flags chore: adding camelcase flag keys to useFlags hook Mar 11, 2026
@joker23 joker23 force-pushed the skz/sdk-2014/camel-case-flags branch 3 times, most recently from fecd4c0 to c26ee61 Compare March 13, 2026 17:02
@joker23 joker23 force-pushed the skz/sdk-2014/camel-case-flags branch from c26ee61 to 11d5dc8 Compare March 13, 2026 17:09
@joker23
Copy link
Contributor Author

joker23 commented Mar 13, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@joker23 joker23 marked this pull request as ready for review March 13, 2026 22:02
@joker23 joker23 requested a review from a team as a code owner March 13, 2026 22:02
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.

1 participant