Skip to content

fix: restore Prevent Flag Defaults UI enforcement in create feature modal#6931

Open
talissoncosta wants to merge 1 commit intomainfrom
fix/prevent-flag-defaults-ui-enforcement
Open

fix: restore Prevent Flag Defaults UI enforcement in create feature modal#6931
talissoncosta wants to merge 1 commit intomainfrom
fix/prevent-flag-defaults-ui-enforcement

Conversation

@talissoncosta
Copy link
Contributor

@talissoncosta talissoncosta commented Mar 12, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #6930

The prevent_flag_defaults project setting was no longer hiding the value and enabled fields when creating a feature flag. This regression was introduced in #6356 where hideValue was hardcoded to false and the prevent_flag_defaults check was dropped.

What changed

  • CreateFeature.tsx: Fetches prevent_flag_defaults via RTK Query (useGetProjectQuery) and conditionally hides the enabled toggle and value editor, showing an info message instead.
  • FeatureUpdateSummary.tsx: Also fetches via RTK Query to conditionally hide the duplicate info message when prevent_flag_defaults is active.
  • index.js: Passes projectId to FeatureUpdateSummary (no longer uses stale Flux ProjectStore.model).

Why RTK Query instead of Flux

The previous ProjectStore.model data was stale — toggling the setting in Project Settings didn't update the create feature modal without a full page reload. Using useGetProjectQuery ensures the data is always fresh via RTK Query's cache invalidation.

How did you test this code?

  1. Enable "Prevent Flag Defaults" in Project Settings > Additional Settings
  2. Open the "New Feature" modal — verify the enabled toggle and value editor are hidden, replaced by an info message
  3. Disable "Prevent Flag Defaults" in Project Settings
  4. Open the "New Feature" modal again — verify the enabled toggle and value editor are visible, with the standard info message at the bottom
  5. Edit an existing feature — verify the Value tab always shows enabled toggle and value editor regardless of the setting

…odal

The prevent_flag_defaults project setting was no longer hiding the value
and enabled fields when creating a feature. This was introduced in #6356
where hideValue was hardcoded to false and the prevent_flag_defaults
check was dropped.

Fetches prevent_flag_defaults via RTK Query (useGetProjectQuery) instead
of the stale Flux ProjectStore, ensuring the setting is always fresh
without requiring a page reload.

Closes #6930

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@talissoncosta talissoncosta requested a review from a team as a code owner March 12, 2026 11:55
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team March 12, 2026 11:55
@vercel
Copy link

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Mar 12, 2026 11:57am
flagsmith-frontend-staging Ready Ready Preview, Comment Mar 12, 2026 11:57am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Mar 12, 2026 11:57am

Request Review

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard fix labels Mar 12, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-6931 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-6931 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6931 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6931 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6931 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6931 Finished ✅ Results

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  28.7 seconds
commit  deda18e
info  🔄 Run: #15256 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  53.7 seconds
commit  deda18e
info  🔄 Run: #15256 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  16 passed

Details

stats  16 tests across 13 suites
duration  18.9 seconds
commit  deda18e
info  🔄 Run: #15256 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  55 seconds
commit  deda18e
info  🔄 Run: #15256 (attempt 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent Flag Defaults: UI enforcement lost in create feature modal refactor

1 participant