Skip to content

Conversation

@talissoncosta
Copy link
Contributor

@talissoncosta talissoncosta commented Jan 20, 2026

Summary

  • Add skip conditions to RTK Query hooks to prevent API requests with undefined/empty environment IDs
  • Fix IdentitySelect component to skip useGetIdentitiesQuery when environmentId is undefined
  • Fix CompareIdentities component to skip useGetProjectFlagsQuery when envId or projectId is missing
  • Enhance useGetIdentityFeatureStatesAllQuery skip conditions to also check for environmentId

Fixes #6534
Fixes FLAGSMITH-FRONTEND-2FM (35,290 events affecting 482 users)

Test plan

  • Navigate directly to the Compare Identities page without selecting an environment
  • Verify no 404 errors appear in the browser network tab for /environments/undefined/ or /environments// paths
  • Select an environment and verify the page functions correctly
  • Select two identities and verify comparison works
  • Check browser console for no [object Response] unhandled promise rejection errors

RTK Query hooks were making API requests with undefined/empty environment
IDs, causing 404 errors like:
- GET /api/v1/environments/undefined/edge-identities/
- GET /api/v1/environments//featurestates/

Added skip conditions to prevent queries from executing when required
parameters are missing:
- IdentitySelect: skip useGetIdentitiesQuery when environmentId is undefined
- CompareIdentities: skip useGetProjectFlagsQuery when envId or projectId
  is missing, and skip useGetIdentityFeatureStatesAllQuery when
  environmentId is undefined

Fixes #6534
Fixes FLAGSMITH-FRONTEND-2FM

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@talissoncosta talissoncosta requested a review from a team as a code owner January 20, 2026 13:16
@talissoncosta talissoncosta requested review from Zaimwa9 and removed request for a team January 20, 2026 13:16
@vercel
Copy link

vercel bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jan 20, 2026 1:27pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jan 20, 2026 1:27pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Ignored Ignored Jan 20, 2026 1:27pm

Request Review

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

github-actions bot commented Jan 20, 2026

Docker builds report

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

…onment

The fetch() method was being called from componentDidUpdate even when
environmentRight was empty, causing API requests like:
- GET /api/v1/environments//featurestates/?page_size=999

Added early return in fetch() when either environment is not selected.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@talissoncosta talissoncosta changed the title fix(frontend): add skip conditions for undefined environment ID queries fix: add skip conditions for undefined environment ID queries Jan 20, 2026
@talissoncosta talissoncosta merged commit 2b832fa into main Jan 20, 2026
34 checks passed
@talissoncosta talissoncosta deleted the 6534-fix-add-skip-conditions-for-undefined-environmentid-in-compareidentities-and-identityselect branch January 20, 2026 15:46
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.

fix: Add skip conditions for undefined environmentId in CompareIdentities and IdentitySelect

3 participants