Skip to content

Conversation

@yugisu-flux
Copy link

@yugisu-flux yugisu-flux commented Dec 3, 2025

What does this PR do?

This PR updates the Flags SDK to evaluate feature flags synchronously.

After these changes, the Flags package API surface should look like the following:

DatadogFlags

  • enable() - Initializes the general Flags SDK
  • getClient() - Retrieves a client by (an optional) name. The recommended way to get client instances. Clients are actually initialized by setEvaluationContext.
  • Update example applications to feature two steps of using the Flags SDK: init blocking rendering and sync flag evaluations

FlagsClient

  • setEvaluationContext() - Sets evaluation context and fetches flag values from the native SDKs. Should be called before flag evaluations, similarly to the mobile SDKs and the web SDK
  • getDetails() typed methods
  • getValue() typed methods

Implementation details

The FlagsClient architecture has been changed from being a thin bridge/wrapper for native getDetails calls to a layer that fetches ALL flags from the native SDK and stores it on the JS side. Individual flag values are synchronously served from this internal cached state via e.g. getBooleanValue method. Flag evaluations are tracked internally by calling an exposed native nativeFlags.trackEvaluation method.

This way, the native SDKs serve a purpose of fetching and persisting flag configurations, and the JavaScript layer tries to stay as thin as possible, while doing the necessary work for sync evals.

The disadvantages to this approach are: implementing some new features like flags polling or local evaluations would be extra work, due to the duplication of cache between native and RN; iOS and Android SDK repositories are modified to accommodate for these changes.

The other approaches that were evaluated during the implementation

Bump minimum RN version for the Flags SDK specifically, and make get*Details calls synchronous by leveraging JSI.

  • Pros: the React Native wrapper becomes extremely thin, future complex features are handled automatically due to JavaScript serving as a thin bridge
  • Cons: limiting customer base, requirement to bump minimum RN version to 0.74-ish (from 0.63)

Drop the dependency on native Flags SDKs, use the JavaScript core from https://github.com/DataDog/openfeature-js-client.

  • Pros: JS-native wrapper, no need to maintain a complex wrapper
  • Cons: no access to native capabilities, need to rewrite the JavaScript core as it very much depends on browser APIs (through the web RUM SDK)

Motivation

Flag evaluations should be synchronous. More details here: https://datadoghq.atlassian.net/browse/FFL-1460

The changes in this PR have been developed jointly with:

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@yugisu-flux yugisu-flux self-assigned this Dec 3, 2025
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Dec 3, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2cc11d6 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Base automatically changed from dima/FFL-906-implement-flags-react-native-ios-wrapper to feature/flags December 9, 2025 17:16
…per' into dima/FFL-1460-sync-flag-evaluation-in-rn-sdk
@yugisu-flux yugisu-flux changed the base branch from feature/flags to dima/FFL-1256-implement-flags-react-native-android-wrapper December 9, 2025 17:20
@yugisu-flux yugisu-flux changed the base branch from dima/FFL-1256-implement-flags-react-native-android-wrapper to feature/flags January 7, 2026 16:08
@yugisu-flux yugisu-flux changed the base branch from feature/flags to dima/update-flags-with-latest-v3 January 7, 2026 16:23
@yugisu-flux yugisu-flux force-pushed the dima/FFL-1460-sync-flag-evaluation-in-rn-sdk branch from 63bb97a to e147449 Compare January 7, 2026 17:25
@yugisu-flux yugisu-flux marked this pull request as ready for review January 7, 2026 17:25
@yugisu-flux yugisu-flux requested a review from a team as a code owner January 7, 2026 17:25
Base automatically changed from dima/update-flags-with-latest-v3 to feature/flags January 12, 2026 13:29
@yugisu-flux yugisu-flux requested a review from sbarrio January 12, 2026 13:30
@yugisu-flux yugisu-flux merged commit 868d9c0 into feature/flags Jan 14, 2026
9 checks passed
@yugisu-flux yugisu-flux deleted the dima/FFL-1460-sync-flag-evaluation-in-rn-sdk branch January 14, 2026 14:41
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.

3 participants