Skip to content

fix(Features): add remove option to feature settings panel - #8203

Open
bardock-2393 wants to merge 2 commits into
Flagsmith:mainfrom
bardock-2393:fix/feature-settings-remove-option
Open

fix(Features): add remove option to feature settings panel#8203
bardock-2393 wants to merge 2 commits into
Flagsmith:mainfrom
bardock-2393:fix/feature-settings-remove-option

Conversation

@bardock-2393

Copy link
Copy Markdown
Contributor

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 #7896

The Settings tab of the create/edit-feature modal only exposed an "Archived" toggle, which looks like the way to delete a feature but isn't — deletion previously only existed in the features list's kebab menu.

Added a "Remove Feature" action to the Settings tab, gated behind the existing DELETE_FEATURE project permission, that reuses the same ConfirmRemoveFeature confirmation modal and removal mutation already used from the features list, closing the enclosing modal on success.

How did you test this code?

No existing Jest/RTL test coverage exists for this component or its siblings in components/modals/create-feature/, so I didn't introduce new test scaffolding for it in isolation. Ran npx eslint --fix on the touched file (clean) and npm run typecheck, confirming an identical error count with and without this change (979, all pre-existing/unrelated) — so this introduces zero new type errors.

The Settings tab only exposed an Archived toggle, which looks like the
way to delete a feature but isn't. Add a "Remove Feature" action that
reuses the existing ConfirmRemoveFeature flow already used from the
features list.
@bardock-2393
bardock-2393 requested a review from a team as a code owner August 1, 2026 18:21
@bardock-2393
bardock-2393 requested review from kyle-ssg and removed request for a team August 1, 2026 18:21
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

@bardock-2393 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 Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

FeatureSettingsTab now checks project-level create and delete permissions. It conditionally renders settings controls and a removal section for existing non-identity features. It opens a confirmation modal before removal. The removal hook handles errors, and successful removal closes the modal.

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

✨ 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.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Aug 1, 2026

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 66a505cc-eacf-4bec-bc95-d131aa92cd27

📥 Commits

Reviewing files that changed from the base of the PR and between fc33002 and 5ba5488.

📒 Files selected for processing (1)
  • frontend/web/components/modals/create-feature/tabs/FeatureSettingsTab.tsx

The tab returned early behind the CREATE_FEATURE permission check
before ever rendering the Remove Feature button added in the previous
commit, so a user granted only DELETE_FEATURE (a distinct, independently
grantable project permission) could never reach it. Broaden the gate to
render for either permission, keeping the editable settings themselves
scoped to CREATE_FEATURE as before.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/web/components/modals/create-feature/tabs/FeatureSettingsTab.tsx (1)

136-148: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Deduplicate the repeated permission InfoMessage block.

The same InfoMessage with dangerouslySetInnerHTML: Constants.projectPermissions(ProjectPermission.CREATE_FEATURE) now appears twice: once as the top-level early return (Lines 140-146) and once inline for the !createFeature branch (Lines 158-164). Extract this block into a small helper or local component to avoid divergence between the two copies.

♻️ Proposed refactor
+const CreateFeaturePermissionMessage: FC = () => (
+  <InfoMessage>
+    <div
+      dangerouslySetInnerHTML={{
+        __html: Constants.projectPermissions(ProjectPermission.CREATE_FEATURE),
+      }}
+    />
+  </InfoMessage>
+)
+
 const FeatureSettingsTab: FC<FeatureSettingsTabProps> = ({
   ...
 }) => {
   ...
   if (!createFeature && !deleteFeature) {
-    return (
-      <InfoMessage>
-        <div
-          dangerouslySetInnerHTML={{
-            __html: Constants.projectPermissions(
-              ProjectPermission.CREATE_FEATURE,
-            ),
-          }}
-        />
-      </InfoMessage>
-    )
+    return <CreateFeaturePermissionMessage />
   }
   ...
   return (
     <div className={`${identity ? 'mx-3' : ''}`}>
-      {!createFeature && (
-        <InfoMessage>
-          <div
-            dangerouslySetInnerHTML={{
-              __html: Constants.projectPermissions(
-                ProjectPermission.CREATE_FEATURE,
-              ),
-            }}
-          />
-        </InfoMessage>
-      )}
+      {!createFeature && <CreateFeaturePermissionMessage />}

Also applies to: 156-166


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c2cfe433-d874-4433-82a9-30476e92eb64

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba5488 and 1c8f8e3.

📒 Files selected for processing (1)
  • frontend/web/components/modals/create-feature/tabs/FeatureSettingsTab.tsx

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

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature settings is missing a "remove" option

1 participant