-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Description
Bug Description
Users encounter a TypeError when editing/toggling features that prevents the operation from completing.
Error: TypeError: Cannot read properties of undefined (reading 'use_v2_feature_versioning')
Sentry Issue: https://flagsmith.sentry.io/issues/7188659117/
Impact
- 5 events / 5 users in 1 day
- First seen: 2026-01-14
- Blocks feature editing operations
Steps to Reproduce
- Open Flagsmith in multiple browser tabs with different projects
- Navigate between projects in different tabs
- On the Features page, click the toggle switch on any feature
- Click "Confirm" in the toggle confirmation modal
- Error occurs because
ProjectStorehas cached environments from a different project
Alternative scenario:
- Have a browser tab open on the Features page
- Let the session remain idle for an extended period
- Try to toggle a feature
ProjectStoremay be stale or out of sync
Root Cause
In frontend/common/stores/feature-list-store.ts lines 276-278:
const env = ProjectStore.getEnvironment(environmentId)
if (env.use_v2_feature_versioning) { // env can be undefinedProjectStore.getEnvironment() returns undefined when the environment isn't found in the cached environments list.
Suggested Fix
Add null check:
const env = ProjectStore.getEnvironment(environmentId)
if (!env) {
console.error(`Environment ${environmentId} not found in ProjectStore`)
store.goneABitWest()
return
}
if (env.use_v2_feature_versioning) {Files to Modify
frontend/common/stores/feature-list-store.ts(lines 276-278)- Same pattern may exist in
editFeatureStateChangeRequestfunction
Metadata
Metadata
Assignees
Labels
No labels