Skip to content

Show every tag inline when the last tag is narrower than the overflow counter - #24045

Merged
desertaxle merged 1 commit into
PrefectHQ:mainfrom
burrows99:fix/tag-group-short-last-tag
Nov 24, 2026
Merged

desertaxle merged 1 commit into
PrefectHQ:mainfrom
burrows99:fix/tag-group-short-last-tag

Conversation

@burrows99

@burrows99 burrows99 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

In the V2 UI, a tag group with two or more short tags shows only the +N counter, even when every tag fits. On the Variables page a variable tagged eu, us shows +2, and the tag names are only visible after clicking it.

TagBadgeGroup sizes itself to the width of its tags and then fits tags into that width. The fit loop broke out at the first tag that did not fit next to the +N counter. When the last tag is narrower than the counter (short tags such as eu, us or v1), the first tag never fits alongside the counter, so the loop stopped at zero visible tags, although all the tags fit once no counter is needed. The loop now keeps going past that tag, so the last tag can still be placed without the counter. Groups whose tags really do not fit are unchanged.

Closes #24083.

flowchart TD
    A[Variable tagged eu and us] --> B{Tags column on the Variables page}
    B -->|Before| C[Shows only the plus two counter]
    B -->|After| D[Shows eu and us inline]
Loading

Narrated recording, before then after (sound on):

evidence.mp4

Recorded against prefect server start (SQLite) and the ui-v2 Vite dev server, before on main and after on this branch, with the same seeded variables.

Edge cases and unchanged behaviour checked

In the running app (shown in the recording):

  • Three short tags (eu, us, ap) all show inline.
  • A single tag (team) shows as before.
  • Six tags still show three tags and +3 (maxTagsDisplayed={3} on the Variables table), and the counter opens the hidden tags with the mouse and with Enter.
  • The Deployments list still shows its prod and etl tags.

By unit test only: the existing fit tests (tags that do not fit, duplicate tags, the widest counter, the requested container width, maxTagsDisplayed) still pass.

Tests

New test in tag-badge-group.test.tsx: two tags that exactly fill the group with a counter wider than the last tag. It fails on main (only +2 is rendered) and passes on this branch.

cd ui-v2
npx vitest run src/components/ui/tag-badge-group.test.tsx   # 15 passed (1 failed on main)
npx biome check src/components/ui/tag-badge-group.tsx src/components/ui/tag-badge-group.test.tsx   # no fixes
npx eslint src/components/ui/tag-badge-group.tsx src/components/ui/tag-badge-group.test.tsx   # clean
npx tsc -b   # clean

I did not run the full ui-v2 test suite or the Playwright e2e tests.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
  • If this pull request adds or changes functionality, it includes tests or explains why tests are not needed.
  • If this pull request changes user-facing behavior, it updates documentation or explains why documentation is not needed. (No docs describe tag overflow.)

AI assistance (Claude Code) was used to find the bug, write the fix and test, and record the video.

🤖 Generated with Claude Code

… counter

TagBadgeGroup sizes itself to the width of its tags, then fits tags into that width. The fit loop stopped at the first tag that did not fit next to the `+N` counter, so when the last tag was narrower than the counter (short tags such as `eu` or `v1`) the group showed only `+2` even though every tag fit. Keep looking past that tag so the last one can be placed without the counter.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T17:30:40.741355Z 74b7860 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74b7860b58

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@desertaxle
desertaxle merged commit 974398c into PrefectHQ:main Nov 24, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2 UI: a tag group with short tags shows only the +N counter although every tag fits

2 participants