Skip to content

feat: return setOptIn from useOptInFlags and drop feature-named aliases - #844

Merged
roncohen merged 3 commits into
mainfrom
feat/opt-in-hook
Nov 29, 2026
Merged

roncohen merged 3 commits into
mainfrom
feat/opt-in-hook

Conversation

@roncohen

@roncohen roncohen commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What changes

  • useOptInFlags() returns setOptIn along with flags and isLoading, in React, Vue and React Native. useSetOptIn() stays as a deprecated alias so v1 code keeps compiling.
  • Opt-in entries have a Boolean value instead of isEnabled. Opt-in only applies to Boolean flags, so value is typed as boolean in the Browser, React, Vue and React Native SDKs. Type tests check this in all four.
  • Removes the deprecated useFeature() (React, React Native) and getFeatures() (Browser) aliases.
  • Fixes the EdgeClient doc comment, which still showed const { isEnabled } = client.getFlag(...).
  • Updates the Browser, React and Vue READMEs, including their v1 migration notes, and the React Native README.

Notes

  • In Vue, the opt-in list now uses shallowRef. The list is always replaced as a whole, so nothing relied on deep reactivity.
  • In React, setOptIn is memoized per client, so it's stable across renders.

Testing

  • Browser 277, React 27, Vue 16, React Native 15 and Node 286 tests pass, including type tests.
  • yarn lint shows one warning, which is already on main.

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

@roncohen
roncohen enabled auto-merge November 29, 2026 18:43

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

@roncohen
roncohen added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit 56bedb7 Nov 29, 2026
9 checks passed
@roncohen
roncohen deleted the feat/opt-in-hook branch November 29, 2026 18:55
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