Skip to content

fix: validate-metadata-required-for-on-all-entities#6658

Open
Zaimwa9 wants to merge 10 commits intomainfrom
fix/required-metadata-validation
Open

fix: validate-metadata-required-for-on-all-entities#6658
Zaimwa9 wants to merge 10 commits intomainfrom
fix/required-metadata-validation

Conversation

@Zaimwa9
Copy link
Contributor

@Zaimwa9 Zaimwa9 commented Feb 4, 2026

Thanks for submitting a PR! Please check the boxes below:

  • 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 #6520

Includes a refactor of the logic in order to prepare #6620

  • Simplified AddMetadataToEntity component
  • Created mergeMetadataFields and metadataValidation in a utils + unit tests
  • Added validation for both update and create for environments and features
  • ⚠️ NB: disabled state for segments has not been implemented as it is on a different page (could be confusing) and error from api is well handled

How did you test this code?

  • New unit tests
  • Create metadata fields in organisation (at least 2 required for each of them)
  • Go to create feature / update feature / create environment / update environment / segments and play around

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner February 4, 2026 17:24
@Zaimwa9 Zaimwa9 requested review from talissoncosta and removed request for a team February 4, 2026 17:24
@vercel
Copy link

vercel bot commented Feb 4, 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 Feb 17, 2026 4:56pm
flagsmith-frontend-staging Ready Ready Preview, Comment Feb 17, 2026 4:56pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Feb 17, 2026 4:56pm

Request Review

@Zaimwa9 Zaimwa9 marked this pull request as draft February 4, 2026 17:24
@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard fix labels Feb 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Docker builds report

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

talissoncosta
talissoncosta previously approved these changes Feb 6, 2026
Copy link
Contributor

@talissoncosta talissoncosta left a comment

Choose a reason for hiding this comment

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

Looks good, just some non blocking comments

}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [metadataFieldsAssociatedtoEntity])
}, [initialFields, metadataFields.length])
Copy link

Choose a reason for hiding this comment

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

Metadata state never refreshes on entity switch

Medium Severity

The initialization effect only copies initialFields when metadataFields.length === 0. After one entity loads, changing entityId keeps previous metadataFields instead of replacing them with new query data, so the form can show and validate stale metadata for the wrong entity.

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

return store.dispatch(
metadataService.endpoints.getEntityMetadataFields.initiate(data, options),
)
}
Copy link

Choose a reason for hiding this comment

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

Unused metadata dispatch helper exported

Low Severity

The new exported helper getEntityMetadataFields appears unused across the frontend. Keeping an unused exported dispatch wrapper in useMetadataField.ts adds dead API surface and makes future maintenance harder because behavior changes may needlessly be kept in sync in multiple access patterns.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove

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.

Custom Fields mandatory field UI/UX bug

2 participants

Comments