Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react/src/declarative/FeatureFlag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function FeatureFlag<T extends FlagValue = FlagValue>({
});

// If the flag evaluation failed, we render the fallback
if (details.reason === 'ERROR') {
if (details.reason === 'ERROR' && details.details?.errorCode !== 'FLAG_NOT_FOUND') {
const fallbackNode: React.ReactNode =
typeof fallback === 'function' ? fallback(details.details as EvaluationDetails<T>) : fallback;
return <>{fallbackNode}</>;
Expand Down
11 changes: 11 additions & 0 deletions packages/react/test/declarative.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ describe('Feature Component', () => {

expect(screen.queryByText(childText)).toBeInTheDocument();
});
it('should render children when flag is missing and defaultValue is true', () => {
render(
<OpenFeatureProvider domain={EVALUATION}>
<FeatureFlag flagKey={MISSING_FLAG_KEY} defaultValue={true}>
<ChildComponent />
</FeatureFlag>
</OpenFeatureProvider>,
);

expect(screen.queryByText(childText)).toBeInTheDocument();
});

it('should not show a non-boolean feature flag without match', () => {
render(
Expand Down
Loading