Skip to content

fix: render all top-level segment rules in the UI instead#7342

Merged
Zaimwa9 merged 1 commit intomainfrom
fix/ui-only-displaying-first-top-level-rule
Apr 30, 2026
Merged

fix: render all top-level segment rules in the UI instead#7342
Zaimwa9 merged 1 commit intomainfrom
fix/ui-only-displaying-first-top-level-rule

Conversation

@Zaimwa9
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 commented Apr 24, 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

Closes #7254

  • Removed the hardcoded *rules[0] to properly deal with multiple top level rules

⚠️ Backend modification were overkill and might have required migrating all existing rules with multiple top level rules

How did you test this code?

  1. Create a segment with multiple top-level rules
  curl -s -X POST http://localhost:8000/api/v1/projects/1/segments/ \
    -H "Authorization: Token <YOUR_API_TOKEN>" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Multi-rule test segment",
    "description": "Testing multiple top-level rules render in the UI",
    "project": 1,
    "rules": [
      {
        "type": "ALL",
        "conditions": [],
        "rules": [
          {
            "type": "ANY",
            "conditions": [
              { "operator": "EQUAL", "property": "country", "value": "GB" },
              { "operator": "EQUAL", "property": "country", "value": "FR" }
            ],
            "rules": []
          }
        ]
      },
      {
        "type": "ALL",
        "conditions": [],
        "rules": [
          {
            "type": "NONE",
            "conditions": [
              { "operator": "EQUAL", "property": "is_bot", "value": "true" }
            ],
            "rules": []
          },
          {
            "type": "ANY",
            "conditions": [
              { "operator": "GREATER_THAN", "property": "age", "value": "18" }
            ],
            "rules": []
          }
        ]
      }
    ]
  }'
  1. Verify in the UI

Open the segment in the dashboard. You should see all 3 rule cards:

  • "Any of the following" — country = GB, country = FR

  • "And none of the following" — is_bot = true

  • "And any of the following" — age > 18

    1. Before the fix

Only the first rule card (country GB/FR) was visible. The other two were silently hidden

Before fix
image

After fix
image

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner April 24, 2026 16:53
@Zaimwa9 Zaimwa9 requested review from kyle-ssg and removed request for a team April 24, 2026 16:53
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 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 Apr 24, 2026 4:54pm
flagsmith-frontend-staging Ready Ready Preview, Comment Apr 24, 2026 4:54pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Apr 24, 2026 4:54pm

Request Review

@Zaimwa9 Zaimwa9 requested review from talissoncosta and removed request for kyle-ssg April 24, 2026 16:54
@Zaimwa9 Zaimwa9 marked this pull request as draft April 24, 2026 16:54
@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard fix labels Apr 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

Docker builds report

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

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

passed  11 passed

Details

stats  11 tests across 8 suites
duration  24.4 seconds
commit  ad79c58
info  🔄 Run: #16331 (attempt 1)

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

passed  11 passed

Details

stats  11 tests across 8 suites
duration  11.4 seconds
commit  ad79c58
info  🔄 Run: #16331 (attempt 1)

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

passed  17 passed

Details

stats  17 tests across 14 suites
duration  53.5 seconds
commit  ad79c58
info  🔄 Run: #16331 (attempt 1)

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

passed  17 passed

Details

stats  17 tests across 14 suites
duration  58.9 seconds
commit  ad79c58
info  🔄 Run: #16331 (attempt 1)

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

passed  11 passed

Details

stats  11 tests across 8 suites
duration  5.5 seconds
commit  ad79c58
info  🔄 Run: #16456 (attempt 1)

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

passed  11 passed

Details

stats  11 tests across 8 suites
duration  50.8 seconds
commit  ad79c58
info  🔄 Run: #16456 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.8 seconds
commit  ad79c58
info  🔄 Run: #16456 (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, 9 seconds
commit  ad79c58
info  🔄 Run: #16456 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

Visual Regression

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

@Zaimwa9 Zaimwa9 marked this pull request as ready for review April 30, 2026 07:52
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@github-actions github-actions Bot added fix and removed fix labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

@talissoncosta talissoncosta left a comment

Choose a reason for hiding this comment

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

Tested locally with curl ✅

Thanks for handling that @Zaimwa9 !!! Good Job!

@Zaimwa9 Zaimwa9 merged commit 94e25f7 into main Apr 30, 2026
46 checks passed
@Zaimwa9 Zaimwa9 deleted the fix/ui-only-displaying-first-top-level-rule branch April 30, 2026 14:19
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.

Segment UI only renders first top-level rule, silently drops additional rules

2 participants