Skip to content

fix(deep-link): feature value renders as [object Object] - #8341

Open
talissoncosta wants to merge 1 commit into
mainfrom
fix/deeplink-feature-value-8337
Open

fix(deep-link): feature value renders as [object Object]#8341
talissoncosta wants to merge 1 commit into
mainfrom
fix/deeplink-feature-value-8337

Conversation

@talissoncosta

Copy link
Copy Markdown
Contributor

Changes

Closes #8337

Opening a flag through the ?feature=<id> deep link, when that flag is beyond the loaded page, fetches it via features/featurestates/. That endpoint returns feature_state_value as 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.

pickEnvironmentFlag now flattens the nested value, mirroring Utils.featureStateToValue. The logic is inlined rather than imported so this hook doesn't pull the Flux stores in through common/utils.

How did you test this code?

  • Unit tests in deepLinkedFeature.test.ts cover the flatten path (nested value in → typed value out) plus the existing match/fallback cases.
  • Manually: on a project with a JSON-valued flag beyond the first page, deep-linked to it via ?feature=<id>&tab=value. On main the editor shows [object Object]; on this branch it renders the real JSON. Confirmed the features/featurestates/ request fires (the deep-fetch path) in both cases.

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 21, 2026 2:57pm
flagsmith-frontend-staging Ready Ready Preview Aug 21, 2026 2:57pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 21, 2026 2:57pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

pickEnvironmentFlag now flattens nested feature-state values for boolean, float, integer, and string types. It returns undefined when no feature state matches. Tests cover optional nested values, selected fields, and value flattening.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7f966

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0244aba0-928b-46a8-bef9-bd98f1a7d39c

📥 Commits

Reviewing files that changed from the base of the PR and between 227fce1 and 2536152.

📒 Files selected for processing (2)
  • frontend/web/components/pages/features/hooks/__tests__/deepLinkedFeature.test.ts
  • frontend/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.

Comment thread frontend/web/components/pages/features/hooks/__tests__/deepLinkedFeature.test.ts Outdated
Comment thread frontend/web/components/pages/features/hooks/deepLinkedFeature.ts Outdated
Comment thread frontend/web/components/pages/features/hooks/deepLinkedFeature.ts Outdated
@talissoncosta
talissoncosta force-pushed the fix/deeplink-feature-value-8337 branch from 2536152 to e1ea3de Compare August 21, 2026 14:20
@talissoncosta
talissoncosta marked this pull request as ready for review August 21, 2026 14:22
@talissoncosta
talissoncosta requested a review from a team as a code owner August 21, 2026 14:22
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team August 21, 2026 14:22
@talissoncosta talissoncosta changed the title Deep-linked feature value renders as [object Object] fix(deep-link): feature value renders as [object Object] Aug 21, 2026
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@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: b7142393-f674-4da9-b9d2-d1ff2304132c

📥 Commits

Reviewing files that changed from the base of the PR and between 2536152 and e1ea3de.

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

@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: 35a7874b-8429-401c-94a7-6947d80ac060

📥 Commits

Reviewing files that changed from the base of the PR and between e1ea3de and e5c6d2a.

📒 Files selected for processing (3)
  • frontend/common/types/responses.ts
  • frontend/web/components/pages/features/hooks/__tests__/deepLinkedFeature.test.ts
  • frontend/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.

Comment thread frontend/web/components/pages/features/hooks/deepLinkedFeature.ts Outdated
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor
✅ oss · depot-ubuntu-latest-arm-16 — run #19631 (attempt 2)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45 seconds
commit  7f96601
info  🔄 Run: #19631 (attempt 2)

🗂️ Previous results
✅ oss · depot-ubuntu-latest-16 — run #19631 (attempt 2)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.4 seconds
commit  7f96601
info  🔄 Run: #19631 (attempt 2)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19631 (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, 4 seconds
commit  7f96601
info  🔄 Run: #19631 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19631 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  35.8 seconds
commit  7f96601
info  🔄 Run: #19631 (attempt 1)

❌ oss · depot-ubuntu-latest-16 — run #19631 (attempt 1)

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  21.4 seconds
commit  7f96601
info  📦 Artifacts: View test results and HTML report
🔄 Run: #19631 (attempt 1)

Failed tests

firefox › 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)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 3 seconds
commit  319af30
info  🔄 Run: #19630 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19630 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32 seconds
commit  319af30
info  🔄 Run: #19630 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19630 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  41 seconds
commit  319af30
info  🔄 Run: #19630 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19630 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42 seconds
commit  319af30
info  🔄 Run: #19630 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19629 (attempt 2)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  46.3 seconds
commit  e5c6d2a
info  🔄 Run: #19629 (attempt 2)

✅ oss · depot-ubuntu-latest-16 — run #19629 (attempt 2)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.8 seconds
commit  e5c6d2a
info  🔄 Run: #19629 (attempt 2)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19628 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  58.5 seconds
commit  e1ea3de
info  🔄 Run: #19628 (attempt 1)

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

…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>
@talissoncosta
talissoncosta force-pushed the fix/deeplink-feature-value-8337 branch from 319af30 to 7f96601 Compare August 21, 2026 14:56

@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: 3fc230f5-d7af-4283-8b5e-676735ba2996

📥 Commits

Reviewing files that changed from the base of the PR and between 319af30 and 7f96601.

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

Comment thread frontend/web/components/pages/features/hooks/deepLinkedFeature.ts

@khvn26 khvn26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved with a question.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: will we deprecate Utils.featureStateToValue eventually?

@talissoncosta talissoncosta Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call @khvn26
I will open a follow up PR decoupling featureStateToValue in order to allow unit tests and consolidate them.

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.

Deep-linked feature value renders as [object Object]

4 participants