Skip to content

feat: show dependency status in Value tab and Dependencies tab badge - #8916

Open
TejasLamba2006 wants to merge 3 commits into
Flagsmith:mainfrom
TejasLamba2006:feat/flag-dependencies-value-tab
Open

TejasLamba2006 wants to merge 3 commits into
Flagsmith:mainfrom
TejasLamba2006:feat/flag-dependencies-value-tab

Conversation

@TejasLamba2006

Copy link
Copy Markdown

Fixes #8855.

What

When a feature flag is served off because one or more of its prerequisites are not met, nothing in the Value tab indicates why. This PR addresses both items from the issue.

1. Warning banner in the Value tab

A Banner (type warning) appears at the top of the Value tab whenever the flag is blocked by unmet prerequisites. It directs the user to the Dependencies tab.

2. x/n met-count badge on the Dependencies tab

A small pill badge shows how many prerequisites are currently satisfied (e.g. 1/2). The badge only appears when there is at least one judged (system-segment) prerequisite. Hand-written segment edges whose operator cannot be inferred are excluded from the count.

How

  • prerequisiteState.ts - new countMetPrerequisites(rows) helper, counts judged rows only.
  • useDependencies.ts - optional skip param threads through to the RTK Query calls so the hook can be called safely before a feature is saved.
  • index.tsx (feature modal) - calls useDependencies with skip: !projectFlag.id. RTK Query serves both callers (modal and FeatureDependenciesTab) from the same cache with no extra request. Derives isBlockedByDependencies and prerequisitesMet, passes them to FeatureValueTab and the Dependencies TabItem.
  • FeatureValueTab.tsx - new optional isBlockedByDependencies prop; renders a Banner when true.
  • TabItem.tsx / TabButton.tsx - new optional tabBadge prop; rendered as a pill span next to the label, alongside the existing isDirty dot.
  • _tabs.scss - .btn-tab__badge pill style using existing tab design tokens.

When a flag is forced off by unmet prerequisites, show a warning
banner in the Value tab explaining why. Add an x/n met-count badge
to the Dependencies tab label so the status is visible without
opening the tab.

- Add `countMetPrerequisites` to prerequisiteState (judged rows only)
- Add optional `skip` to `useDependencies` for pre-create guards
- Add `tabBadge` prop to `TabItem` / `TabButton` with pill styling
- Add `isBlockedByDependencies` prop to `FeatureValueTab`
- Call `useDependencies` in the feature modal (RTK Query cache hit,
  no extra request) to derive both signals and wire them up

Closes Flagsmith#8855
@TejasLamba2006
TejasLamba2006 requested a review from a team as a code owner November 9, 2026 16:40
@TejasLamba2006
TejasLamba2006 requested review from kyle-ssg and removed request for a team November 9, 2026 16:40
@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

@TejasLamba2006 is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d0daed1a-3309-4af2-98ab-76ea0fabb7bc
Commits

Reviewing files that changed from the base of the PR and between 3e3c9bd and 5e443d3.

Files selected for processing: 5

  • frontend/common/hooks/useFeatureStates.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/__tests__/prerequisiteState.test.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/useDependencies.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/prerequisiteState.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureValueTab.tsx
Walkthrough

The feature modal queries dependency rows for the current environment and feature. It derives the met prerequisite count and whether unmet prerequisites block the feature. The Value tab displays a warning when the feature is blocked. The Dependencies tab displays the met and total prerequisite count when available. The dependency hook can skip both dependency queries and feature-state loading.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Low

Merge Risk: Low · previous review 3e3c9

The status display is mergeable with bounded follow-up: large projects can receive incorrect prerequisite warnings, and some warning paths lead to unavailable details. Initial loading no longer produces false warnings.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ded878e1-157d-4a59-821c-d3b5aa5bc9fe
Commits

Reviewing files that changed from the base of the PR and between 13539af and 7ecb2cd.

Files selected for processing: 8

  • frontend/web/components/modals/create-feature/index.tsx
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/useDependencies.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/index.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/prerequisiteState.ts
  • frontend/web/components/modals/create-feature/tabs/FeatureValueTab.tsx
  • frontend/web/components/navigation/TabMenu/TabButton.tsx
  • frontend/web/components/navigation/TabMenu/TabItem.tsx
  • frontend/web/styles/components/_tabs.scss

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment on lines +174 to +181
const { rows: prerequisiteRows } = useDependencies({
environmentId,
featureId: projectFlag.id,
projectId,
skip: !projectFlag.id,
})
const prerequisitesMet = countMetPrerequisites(prerequisiteRows)
const isBlockedByDependencies = isBlocked(prerequisiteRows)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

rg -n 'useFeatureStates|toPrerequisiteRows' frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab; sed -n '1,110p' frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/prerequisiteState.ts

Repository: Flagsmith/flagsmith

Length of output: 4909


Script executed:

p=frontend/web/components/modals/create-feature
nl -ba "$p/tabs/FeatureDependenciesTab/hooks/useDependencies.ts"
nl -ba frontend/common/hooks/useFeatureStates.ts 2>/dev/null || rg --files frontend | rg 'useFeatureStates'
nl -ba "$p/index.tsx" | sed -n '110,205p;790,930p'
nl -ba "$p/tabs/FeatureValueTab.tsx" | sed -n '1,130p;350,405p'
git diff 13539afcb99c20b4351e26f215d01b49f2a9be03 7ecb2cd46d38b3123726eead7965e2e006b516df -- "$p/tabs/FeatureDependenciesTab/hooks/useDependencies.ts" "$p/index.tsx" "$p/tabs/FeatureValueTab.tsx"

Repository: Flagsmith/flagsmith

Length of output: 30333


Script executed:

p=frontend/web/components/modals/create-feature
rg -n 'isDependenciesTabEnabled|return \(|isLoading|isError|FeatureDependenciesTab' "$p/index.tsx" "$p/tabs/FeatureDependenciesTab/FeatureDependenciesTab.tsx" "$p/tabs/FeatureValueTab.tsx"
nl -ba "$p/index.tsx" | sed -n '210,330p;580,665p;670,720p;745,810p;940,1035p'
nl -ba "$p/tabs/FeatureDependenciesTab/FeatureDependenciesTab.tsx" | sed -n '1,210p'
nl -ba "$p/tabs/FeatureDependenciesTab/prerequisiteState.ts" | sed -n '1,100p'
nl -ba "$p/tabs/FeatureDependenciesTab/__tests__/prerequisiteState.test.ts" | sed -n '1,125p'

Repository: Flagsmith/flagsmith

Length of output: 38576


Script executed:

nl -ba frontend/web/components/modals/create-feature/index.tsx | sed -n '450,590p'
nl -ba frontend/web/components/modals/create-feature/tabs/FeatureValueTab.tsx | sed -n '245,275p;330,375p'
nl -ba frontend/web/components/navigation/TabMenu/TabItem.tsx
nl -ba frontend/web/components/navigation/TabMenu/TabButton.tsx | sed -n '1,100p'

Repository: Flagsmith/flagsmith

Length of output: 11204


Hide prerequisite status until the feature list is available.

If dependency edges load before the feature list, or the feature-list request fails, the modal can show 0/n and claim the flag is forced off even when its prerequisites are enabled. Suppress the badge and warning while prerequisite states are loading or unavailable.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bd3b0eee-43cd-4aa5-b941-566801763808
Commits

Reviewing files that changed from the base of the PR and between 7ecb2cd and 3e3c9bd.

Files selected for processing: 4

  • frontend/common/hooks/useFeatureStates.ts
  • frontend/web/components/modals/create-feature/index.tsx
  • frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/useDependencies.ts
  • frontend/web/components/navigation/TabMenu/TabButton.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

Comment on lines +44 to +50
const isReady =
!skip &&
!isDependenciesError &&
!isLoadingDependencies &&
!featureStates.isLoading &&
!featureStates.isError &&
featureStates.hasLoadedFeatures

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Low value

Supported by static analysis

Script executed:

sed -n '85,145p' frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/FeatureDependenciesTab.tsx; sed -n '28,55p' frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/usePrerequisites.tsx

Repository: Flagsmith/flagsmith

Length of output: 2987


Script executed:

git diff 13539afcb99c20b4351e26f215d01b49f2a9be03 3e3c9bd395fb75b02f30d0333934bd692da3e449 -- frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/useDependencies.ts frontend/web/components/modals/create-feature/index.tsx frontend/common/hooks/useFeatureStates.ts frontend/web/components/navigation/TabMenu/TabButton.tsx
nl -ba frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/useDependencies.ts | sed -n '1,200p'
nl -ba frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/FeatureDependenciesTab.tsx | sed -n '1,220p'
rg -n -F -e 'isReady' -e 'BlockedBanner' -e 'useDependencies(' -- frontend/web/components/modals/create-feature

Repository: Flagsmith/flagsmith

Length of output: 21166


Script executed:

nl -ba frontend/web/components/modals/create-feature/index.tsx | sed -n '150,200p;780,935p'
nl -ba frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/hooks/usePrerequisites.tsx | sed -n '1,180p'
nl -ba frontend/web/components/modals/create-feature/tabs/FeatureDependenciesTab/prerequisiteState.ts | sed -n '1,220p'
rg -n -F -e 'isBlockedByDependencies' -e 'Dependencies tab' -- frontend/web/components/modals/create-feature
nl -ba frontend/common/services/useFeatureDependency.ts | sed -n '1,220p'
nl -ba frontend/common/hooks/useFeatureStates.ts | sed -n '1,130p'

Repository: Flagsmith/flagsmith

Length of output: 29144


Script executed:

nl -ba frontend/web/components/modals/create-feature/tabs/FeatureValueTab.tsx | sed -n '355,410p'
rg -n -F -- 'isDependenciesTabEnabled' frontend/web/components/modals/create-feature/index.tsx
nl -ba frontend/web/components/modals/create-feature/index.tsx | sed -n '85,150p'
rg -n -F -e 'feature_dependencies' -e 'feature-dependencies' -e 'featureDependencies' -- frontend/common frontend/web/components/modals/create-feature | sed -n '1,120p'

Repository: Flagsmith/flagsmith

Length of output: 6074


Keep prerequisite details available when dependents fail.

When the dependents request fails, the Value tab can direct users to details that the Dependencies tab replaces with an error. Handle dependents loading and errors separately from prerequisite details, while keeping actions that require dependents gated.

This branch has not been deployed

No deployments
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.

Flag dependencies are not reflected in the feature Value tab

1 participant