Skip to content

fix(ui): keep compare header links inside their grid column#2805

Open
rohitg00 wants to merge 6 commits into
npmx-dev:mainfrom
rohitg00:fix/comparison-header-overflow
Open

fix(ui): keep compare header links inside their grid column#2805
rohitg00 wants to merge 6 commits into
npmx-dev:mainfrom
rohitg00:fix/comparison-header-overflow

Conversation

@rohitg00
Copy link
Copy Markdown

Fixes #2802

On the compare page, package headers like @agentmemory/agentmemory ran wider than their grid column and visibly overlapped both the sticky label cell on the left and the next package header on the right.

The header link in ComparisonGrid.vue was flex min-w-0 flex-col with no flex-1 / w-full, so it sized to its intrinsic content width and escaped the grid track. Adding flex-1 makes the link fill the available track width, which gives the inner line-clamp-1 spans a real width to clamp against. The existing min-w-0 already lets it shrink when the column is narrower than the name.

Repro URL: https://npmx.dev/compare?packages=@agentmemory/agentmemory,claude-mem,supermemory,mem0ai&layout=split

I also added a small regression test that mounts the grid with the four packages from the screenshot above and asserts the long-name header link carries flex-1 and min-w-0.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 26, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment May 26, 2026 8:18pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview May 26, 2026 8:18pm
npmx-lunaria Ignored Ignored May 26, 2026 8:18pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6eb202af-a089-433b-bc75-d17858593a10

📥 Commits

Reviewing files that changed from the base of the PR and between 8f56990 and f29eb4b.

📒 Files selected for processing (1)
  • test/nuxt/components/compare/ComparisonGrid.spec.ts
💤 Files with no reviewable changes (1)
  • test/nuxt/components/compare/ComparisonGrid.spec.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved comparison grid header layout so long scoped package names and versions truncate correctly and no longer overflow their column.
  • Tests

    • Updated tests to verify header anchors for long package names and versions use truncation and constrained layout to prevent overflow.

Walkthrough

Add flex-1 to package header LinkBase and change the visible name span to w-full truncate; update the header rendering test to assert .truncate elements for long package names.

Changes

Header link flex layout and overflow constraint

Layer / File(s) Summary
Header link class update and tests
app/components/Compare/ComparisonGrid.vue, test/nuxt/components/compare/ComparisonGrid.spec.ts
Add flex-1 to the header link and change the visible name span to w-full truncate. Update the long-name header test to expect two .truncate parts and adjust the test description.

Suggested reviewers

  • alexdln
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: adding flex-1 to the header link to keep it within grid column bounds, resolving the overflow issue.
Description check ✅ Passed The description clearly relates to the changeset, explaining the overflow problem, root cause (missing flex-1), the solution, and rationale for using truncate instead of line-clamp-1.
Linked Issues check ✅ Passed The PR fully addresses issue #2802 by adding flex-1 to the LinkBase component to constrain header widths, switching to truncate for proper scoped-name visibility, and including a regression test.
Out of Scope Changes check ✅ Passed All changes (flex-1 addition, truncate replacement, and test update) are directly scoped to fixing the comparison header overflow issue and have no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions
Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @rohitg00! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@graphieros graphieros left a comment

Choose a reason for hiding this comment

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

@rohitg00 Thank you for your PR :)

From what I can see, long package names still bleed, and the start of the name can also appear cropped in some cases:

Image

I think using ellipsis for package names in the headers can be a good alternative (it is already used in other places in the compare page, inside the charts for example).

Replace break-words + line-clamp-1 with truncate (single-line ellipsis)
on the package name and version spans, matching the pattern already used
for chart labels in the same page.

Previously, scoped names like @agentmemory/agentmemory broke at the '@'
boundary so the scope prefix wrapped onto a second line that line-clamp-1
hid, making it look like the start of the name was cropped. Truncation
keeps the start visible and ends in '…' when the name overflows.
@rohitg00
Copy link
Copy Markdown
Author

Thanks @graphieros — you're right, the previous fix didn't help with long names. Pushed 8f56990 to switch the name + version spans to truncate (single-line ellipsis), same pattern as the chart labels in this page.

Root cause of the cropped start in your screenshot: break-words was breaking the scope prefix at the @, pushing it onto a second line that line-clamp-1 then hid, so visually you only saw the tail. truncate keeps the start anchored and ends in when it overflows the column.

Comment on lines 62 to 78
it('constrains the header link to its grid track so long scoped names cannot overflow', async () => {
const scopedName = '@scope/very-long-package-name'
const scopedVersion = '1.2.3'
const component = await mountSuspended(ComparisonGrid, {
props: {
columns: [
{ name: scopedName, version: scopedVersion },
...cols('pkg-b@1.0.0', 'pkg-c@1.0.0', 'pkg-d@1.0.0'),
],
},
})

const link = component.find(`a[title="${scopedName}@${scopedVersion}"]`)
expect(link.exists()).toBe(true)
expect(link.classes()).toContain('flex-1')
expect(link.classes()).toContain('min-w-0')
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure this test makes sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, the css change is enough and does not require coverage in my opinion.

@graphieros
Copy link
Copy Markdown
Contributor

@rohitg00

I suspect your previous answer (if not this PR) was generated by an agent.
It is important for the npmx team to have a 'people first' approach, and if we are ok with contributors using AI as a tool, the human connection is part of the essence of npmx.

Therefore I would be happy to merge your PR (probably without the test, if you were so kind to consider its removal), should you answer to this message in your own words.

@rohitg00
Copy link
Copy Markdown
Author

Hey! @graphieros Yeah, I use Agents a lot. I made this PR with Claude code, but I guided it and faced problem myself when I was comparing different memories with my agentmemory project.

Thanks, happy to help.

@graphieros
Copy link
Copy Markdown
Contributor

@rohitg00

Thanks, and nice to meet you :)

Copy link
Copy Markdown
Contributor

@graphieros graphieros left a comment

Choose a reason for hiding this comment

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

(see remarks regarding the test)

Per reviewer feedback: the CSS change covers the behavior; asserting on
flex-1/min-w-0 class names doesn't add meaningful coverage.
@rohitg00
Copy link
Copy Markdown
Author

rohitg00 commented May 26, 2026

Agreed @gameroman @graphieros : dropped that test in f29eb4b. Kept only the title-attribute / render assertion.

Copy link
Copy Markdown
Contributor

@graphieros graphieros left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you for dropping the em dash in that last comment ;)

@graphieros graphieros requested a review from gameroman May 26, 2026 20:23
@rohitg00
Copy link
Copy Markdown
Author

LGTM Thank you for dropping the em dash in that last comment ;)

I hate emdashes.

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.

fix: comparison header overflows column with long scoped package names

3 participants