Skip to content

refactor: create feature migration#6925

Open
kyle-ssg wants to merge 132 commits intochore/permission-typesfrom
chore/create-feature-migration-continued
Open

refactor: create feature migration#6925
kyle-ssg wants to merge 132 commits intochore/permission-typesfrom
chore/create-feature-migration-continued

Conversation

@kyle-ssg
Copy link
Member

@kyle-ssg kyle-ssg commented Mar 11, 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

Migrates all tabs including the create feature modal itself to TypeScript, no type errors to do with creating / editing a feature and also reduces the feature modal by ~1200 LoC.

Migrates a few components to ES export

How did you test this code?

  • E2E was extended to cover more of the feature management process specifically for this PR
  • Created / edited features in production

# Conflicts:
#	.github/workflows/.reusable-docker-e2e-tests.yml
#	frontend/.claude/context/e2e.md
#	frontend/Makefile
#	frontend/api/index.js
#	frontend/e2e/global-setup.playwright.ts
#	frontend/e2e/helpers/e2e-helpers.playwright.ts
#	frontend/e2e/tests/change-request-test.pw.ts
#	frontend/e2e/tests/flag-tests.pw.ts
#	frontend/e2e/tests/invite-test.pw.ts
#	frontend/e2e/tests/organisation-test.pw.ts
#	frontend/e2e/tests/project-permission-test.pw.ts
#	frontend/e2e/tests/project-test.pw.ts
#	frontend/e2e/tests/segment-test.pw.ts
#	frontend/e2e/tests/versioning-tests.pw.ts
#	frontend/package-lock.json
…tion-continued

# Conflicts:
#	frontend/web/components/modals/create-feature/index.js
#	frontend/web/components/modals/create-feature/tabs/CreateFeatureTab.tsx
#	frontend/web/components/modals/create-feature/tabs/FeatureSettingsTab.tsx
#	frontend/web/components/modals/create-feature/tabs/FeatureValue.tsx
@vercel
Copy link

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

Request Review

@kyle-ssg kyle-ssg changed the base branch from main to chore/permission-types March 11, 2026 15:22
@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard chore labels Mar 11, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

Docker builds report

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  11.9 seconds
commit  f1c6066
info  🔄 Run: #15242 (attempt 1)

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  48 seconds
commit  f1c6066
info  🔄 Run: #15242 (attempt 1)

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

passed  16 passed

Details

stats  16 tests across 13 suites
duration  1 minute, 7 seconds
commit  f1c6066
info  🔄 Run: #15242 (attempt 1)

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  48.9 seconds
commit  ba41b02
info  🔄 Run: #15243 (attempt 1)

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  49.5 seconds
commit  ba41b02
info  🔄 Run: #15243 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 17 seconds
commit  f1c6066
info  🔄 Run: #15242 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  54.2 seconds
commit  ba41b02
info  🔄 Run: #15243 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 2 seconds
commit  ba41b02
info  🔄 Run: #15243 (attempt 1)

Comment on lines +91 to +97
const envId = project?.environments?.find(
(env) => env.api_key === environmentId,
)?.id
if (!envId) {
setUserOverridesNoPermissionState()
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I might have found a bug

This is comparing api_key (a string like "RAvjEqbj96SXiJP4hQHd5E") with environmentId which is now a numeric ID (e.g. "123") after #6322. They'll never match, so it always falls into the no-permission state.

environmentId is already the numeric ID, so this lookup can be removed and environmentId passed directly to getPermission.

I am getting this:

Image

Comment on lines +98 to +105
getPermission(
getStore(),
{
id: envId,
level: 'environment',
},
{ forceRefetch },
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
getPermission(
getStore(),
{
id: envId,
level: 'environment',
},
{ forceRefetch },
)
getPermission(
getStore(),
{
id: environmentId,
level: 'environment',
},
{ forceRefetch },
)

it seems to do the trick

Comment on lines +61 to +63
const environment = project?.environments?.find(
(env) => env.api_key === environmentId,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same api_key vs numeric ID issue as above — environment is always undefined, so isVersioned and is4Eyes are always false. This silently bypasses 4-eyes/change requests for segment overrides.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const environment = project?.environments?.find(
(env) => env.api_key === environmentId,
)
const environment = getEnvironment(environmentId)

userOverridesPage(1)
})
.catch(() => {
setIsLoading(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about adding setUserOverridesErrorState in here as well to avoid silent errors ?

Suggested change
setIsLoading(false)
setIsLoading(false)
setUserOverridesErrorState()

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants