fix(deep-link): feature value renders as [object Object] - #8341
fix(deep-link): feature value renders as [object Object]#8341talissoncosta wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR fixes incorrect rendering and accidental persistence of deep-linked feature values. No actionable merge-blocking risk remains; the remaining concern is limited to a non-functional TypeScript style cleanup. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0244aba0-928b-46a8-bef9-bd98f1a7d39c
📒 Files selected for processing (2)
frontend/web/components/pages/features/hooks/__tests__/deepLinkedFeature.test.tsfrontend/web/components/pages/features/hooks/deepLinkedFeature.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
2536152 to
e1ea3de
Compare
Docker builds report
|
e1ea3de to
e5c6d2a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b7142393-f674-4da9-b9d2-d1ff2304132c
📒 Files selected for processing (1)
frontend/web/components/pages/features/hooks/deepLinkedFeature.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 35a7874b-8429-401c-94a7-6947d80ac060
📒 Files selected for processing (3)
frontend/common/types/responses.tsfrontend/web/components/pages/features/hooks/__tests__/deepLinkedFeature.test.tsfrontend/web/components/pages/features/hooks/deepLinkedFeature.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.
✅ oss · depot-ubuntu-latest-arm-16 — run #19631 (attempt 2)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
🗂️ Previous results✅ oss · depot-ubuntu-latest-16 — run #19631 (attempt 2)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19631 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #19631 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
❌ oss · depot-ubuntu-latest-16 — run #19631 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Failed testsfirefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss ✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19630 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
✅ private-cloud · depot-ubuntu-latest-16 — run #19630 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19630 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19630 (attempt 1)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ oss · depot-ubuntu-latest-arm-16 — run #19629 (attempt 2)Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
✅ oss · depot-ubuntu-latest-16 — run #19629 (attempt 2)Playwright Test Results (oss - depot-ubuntu-latest-16)Details
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19628 (attempt 1)Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
e5c6d2a to
319af30
Compare
…s it
Opening a flag via the ?feature= deep link when it is beyond the loaded
page fetches it through features/featurestates/, which returns
feature_state_value as a nested {type, string_value, ...} object rather
than the flat value the feature-list path supplies. The value editor
stringified that object to "[object Object]", and a save would have
persisted it over the real value.
Flatten the nested value in pickEnvironmentFlag, mirroring
Utils.featureStateToValue (inlined to keep the Flux stores out of this
hook).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
319af30 to
7f96601
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3fc230f5-d7af-4283-8b5e-676735ba2996
📒 Files selected for processing (1)
frontend/web/components/pages/features/hooks/deepLinkedFeature.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.
| type FlattenableFeatureStateValue = FlagsmithValue | FeatureStateValue | ||
|
|
||
| // The featurestates endpoint returns a nested value; the list path is flat. | ||
| // Mirrors Utils.featureStateToValue, inlined to keep the Flux stores out. |
There was a problem hiding this comment.
Question: will we deprecate Utils.featureStateToValue eventually?
Changes
Closes #8337
Opening a flag through the
?feature=<id>deep link, when that flag is beyond the loaded page, fetches it viafeatures/featurestates/. That endpoint returnsfeature_state_valueas a nested{ type, string_value, integer_value, boolean_value, float_value }object, whereas the feature-list path supplies a flat value. The value editor stringified the nested object to[object Object], and a save (even with no edits) would have persisted that over the real value.pickEnvironmentFlagnow flattens the nested value, mirroringUtils.featureStateToValue. The logic is inlined rather than imported so this hook doesn't pull the Flux stores in throughcommon/utils.How did you test this code?
deepLinkedFeature.test.tscover the flatten path (nested value in → typed value out) plus the existing match/fallback cases.?feature=<id>&tab=value. Onmainthe editor shows[object Object]; on this branch it renders the real JSON. Confirmed thefeatures/featurestates/request fires (the deep-fetch path) in both cases.