Skip to content

fix(web): keep pricing layout still while the catalog loads - #536

Merged
markbang merged 7 commits into
mainfrom
fix/pricing-cls
Nov 20, 2026
Merged

markbang merged 7 commits into
mainfrom
fix/pricing-cls

Conversation

@markbang

@markbang markbang commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The pricing page moved while the billing catalog loaded:

SSR markup            "No plans available" (36px)
  -> hydration        skeleton (706px), and the promo offer inserted above the headline
  -> catalog arrives  controls, plan grid and sticky bar (1074px), and the headline moves down
  -> desktop          checkout summary (331px) lands 8px taller than the catalog column

This PR changes only PricingView.svelte and PurchasePanel.svelte:

  • The loading state renders on the server, sized like the loaded page: two segmented controls with the savings note hidden, three cards sized like the monthly plan cards, and a hidden sticky bar. The promo eyebrow gets a fixed 28px slot.
  • While the catalog is pending, the desktop checkout summary shows a placeholder sized to the signed-out loaded summary (288.5px). A comment records the signed-in tradeoff.

Font loading is unchanged. An earlier round of this PR changed global font loading (font-display, a preload, a metric-matched fallback face); those commits are reverted here (b274194c, 89634fc1) to keep the change scoped to the pricing components.

Evidence

Mobile 390, 4× CPU, throttled network, local production build. Before = main, after = this PR's placeholder changes (measured on d1c857d4 + 2e5f868b, the code in this head).

Run EN before → after ZH before → after
Lighthouse mobile CLS (median of 3) 0.4745 → 0.0006 0.4531 → 0.0003
Scripted scroll, 8 screens 0.4648 → 0.0006 0.4698 → 0.0003
Scripted scroll from load 0.8660 → 0.0006 0.7584 → 0.0003
Desktop 1440 scroll 0.00059 → layout shift from the summary removed

The remaining ~0.0006 EN / 0.0003 ZH is the Geist font swap (text reflow when the webfont replaces the fallback); Lighthouse displays it as 0.001. It is site-wide and not addressed here.

Full-page screenshots at 390 and 1440, EN and ZH, before vs after: pixel-identical once loaded.

Checks

  • biome check on both touched files: clean.
  • apps/web typecheck (svelte-check): 0 errors.
  • apps/web tests passed on the earlier head with the same component code (485 + 3 + 3).
  • Covered by CI only: apps/api and other workspaces' tests, production build.

Known gaps

  • Residual CLS ~0.0006 (Lighthouse 0.001) from the Geist font swap.
  • Signed-in desktop CLS ~0.0024: the signed-in summary (321px + 16.5px code row) is taller than the signed-out placeholder. Auth is known only after hydration; padding for it would add ~32px blank space for every anonymous visitor. Accepted.
  • Placeholder sizes match today's monthly cards; the pending plans/packs switch assumes packs exist.
  • Sheet density (BillingConversionCenter) uses the same placeholder; not measured.

Merge Danger

Door: two-way

Blast Radius: the pricing page, plus the billing settings and conversion sheet that render PurchasePanel's loading state. No global CSS or font change.

The pricing page rendered "No plans available" on the server and then
grew to a 220px skeleton and finally to the real plan grid, controls and
sticky bar. The promo eyebrow was also inserted above the headline after
load. Every step pushed the sections below, which is the layout shift
behind the pricing CLS report.

- Render the loading state whenever no catalog is in yet, including on
  the server, and size it like the loaded monthly cards.
- Render the segmented controls and the sticky bar as placeholders while
  pending, with the hidden savings note, so they wrap and size like the
  loaded state.
- Reserve a fixed-height slot for the promo eyebrow.
@markbang markbang changed the title fix(web): keep pricing layout still while the catalog loads fix(web): keep pricing layout still while the catalog and font load Nov 19, 2026
@markbang markbang changed the title fix(web): keep pricing layout still while the catalog and font load fix(web): keep pricing layout still while the catalog loads Nov 20, 2026
@markbang
markbang merged commit 719dc80 into main Nov 20, 2026
4 checks passed
@markbang
markbang deleted the fix/pricing-cls branch November 20, 2026 05:41
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