Skip to content

fix(react): honor default value for missing feature flags - #1451

Open
Jyatin wants to merge 1 commit into
open-feature:mainfrom
Jyatin:fix/featureflag-default-value
Open

fix(react): honor default value for missing feature flags#1451
Jyatin wants to merge 1 commit into
open-feature:mainfrom
Jyatin:fix/featureflag-default-value

Conversation

@Jyatin

@Jyatin Jyatin commented Aug 22, 2026

Copy link
Copy Markdown

Description

Fixes an issue where FeatureFlag treated a missing flag as an error and rendered the fallback instead of using the provided defaultValue.

When the evaluation reason is ERROR with FLAG_NOT_FOUND, the component now continues through the normal matching logic so boolean flags can correctly use their default value.

Testing

  • 7 test suites passed
  • 86 tests passed
  • git diff --check passed

Fixes #1447

@Jyatin
Jyatin requested review from a team as code owners August 22, 2026 19:09
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ac41ee1d-ba0b-4bef-af39-91f37423e572

📥 Commits

Reviewing files that changed from the base of the PR and between 0f47863 and bee99ae.

📒 Files selected for processing (2)
  • packages/react/src/declarative/FeatureFlag.tsx
  • packages/react/test/declarative.spec.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

FeatureFlag now treats FLAG_NOT_FOUND as a normal evaluation path. A test verifies that defaultValue={true} renders the children when the flag is missing.

Changes

FeatureFlag fallback behavior

Layer / File(s) Summary
Missing-flag default handling
packages/react/src/declarative/FeatureFlag.tsx, packages/react/test/declarative.spec.tsx
FLAG_NOT_FOUND no longer triggers the early error fallback. The test verifies that children render when a missing flag uses defaultValue={true}.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to bee99

This localized change makes missing feature flags honor their provided default values, with no actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: aepfli

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes make missing flags follow normal matching logic and honor defaultValue, which satisfies issue #1447.
Out of Scope Changes check ✅ Passed The code and test changes are limited to the missing-flag defaultValue behavior described in issue #1447.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Title check ✅ Passed The title clearly and concisely describes the fix to honor default values for missing feature flags in the React component.
Description check ✅ Passed The description accurately explains the missing-flag behavior change, test coverage, and linked issue.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jyatin Jyatin changed the title fix(react): honor default value for missing feature flags fix(react): honor default value for missing feature flags Aug 22, 2026
@Jyatin

Jyatin commented Aug 26, 2026

Copy link
Copy Markdown
Author

Hi, the implementation and tests are complete, and the automated checks are passing. Could a code owner from open-feature/maintainers or open-feature/sdk-javascript-maintainers please review this PR when available? Thanks!

@Jyatin

Jyatin commented Aug 28, 2026

Copy link
Copy Markdown
Author

Hi! Just following up on PR #1451 when you get a chance. The implementation and tests are complete, and all required checks are passing. It’s currently just waiting on a code-owner review. Thanks!

Signed-off-by: Jyatin Singh <singhjyatin@gmail.com>
@Jyatin
Jyatin force-pushed the fix/featureflag-default-value branch from bee99ae to 4ebb05a Compare September 1, 2026 13:53
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.

[BUG] FeatureFlag component defaultValue not working as spected

1 participant