Skip to content

fix(dashboard): truncate long checkout URL from the start - #2344

Merged
charlietlamb merged 1 commit into
devfrom
charlie/fix-checkout-url-truncation
Jul 22, 2026
Merged

fix(dashboard): truncate long checkout URL from the start#2344
charlietlamb merged 1 commit into
devfrom
charlie/fix-checkout-url-truncation

Conversation

@charlietlamb

@charlietlamb charlietlamb commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

In the "Checkout URL Generated" view, the checkout URL was clipped on both ends — the start (https://checkout.stripe.com/...) was cut off, with no trailing ellipsis.

Root cause

CopyButton already passes truncate and min-w-0 flex-1, so it looked like it should truncate.

The actual constraint is one layer up: Button wraps all children in a hardcoded <span className="inline-flex items-center gap-2"> with no width limit. That wrapper sized itself to the full URL (~1777px), overflowed the 406px button, and — because the button is justify-center — got clipped symmetrically, hiding the start.

Fix

Scoped entirely to the call site:

  • [&>span]:min-w-0 [&>span]:max-w-full constrains the Button's child wrapper so the truncating child can shrink.
  • text-left puts the ellipsis at the end instead of centering the text.

Why not fix Button itself

An earlier revision added min-w-0 max-w-full to the wrapper in packages/ui/.../button.tsx. That works, but it changes every button in the app for one call site's problem, so it was dropped in favour of the call-site variant. Measured results are identical.

For the record, I also verified that the simpler options do not work — min-w-0, overflow-hidden, and both together on the button's own className all leave the wrapper at 1776.8px with the URL start still off-screen, because overflow-hidden hides the overflow without making the text truncate.

Verification

Measured on the real component with button.tsx untouched:

before after
wrapper span 1776.8px 390px
URL span 1754.8px 368px
truncating no yes
start visible no yes

Renders as https://checkout.stripe.com/c/pay/cs_test_a1J2Rpdm…

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Button wraps children in an unconstrained inline-flex span, so the long
checkout URL sized that wrapper past the button and got clipped on both
ends by justify-center, hiding the start of the URL.

Constrain the wrapper from the call site so the URL can shrink, and
left-align it so the ellipsis lands at the end.
@charlietlamb
charlietlamb force-pushed the charlie/fix-checkout-url-truncation branch from 04ef5ef to d6763a0 Compare July 22, 2026 09:44
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
checkout Ignored Ignored Jul 22, 2026 9:45am
landing-page Ignored Ignored Jul 22, 2026 9:45am

Request Review

@charlietlamb charlietlamb changed the title fix(ui): truncate long URLs in copy button from the start fix(dashboard): truncate long checkout URL from the start Jul 22, 2026
@charlietlamb
charlietlamb merged commit 6511648 into dev Jul 22, 2026
16 checks passed
@charlietlamb
charlietlamb deleted the charlie/fix-checkout-url-truncation branch July 22, 2026 11:55
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.

1 participant