Skip to content

fix(ui): Avoid domain and billing loading shifts#9169

Merged
alexcarpenter merged 3 commits into
mainfrom
carp/fix-domain-loading-shift
Jul 15, 2026
Merged

fix(ui): Avoid domain and billing loading shifts#9169
alexcarpenter merged 3 commits into
mainfrom
carp/fix-domain-loading-shift

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Jul 15, 2026

Copy link
Copy Markdown
Member

Description

Reduce layout shift while the organization and billing UI load. Each section now reserves its loaded height while data is fetched, so surrounding content no longer jumps when it resolves.

  • Domains: the loading placeholder matches a single domain row height.
  • Subscription: reserves the loaded card + button height and shows a loading indicator. Previously it rendered nothing while loading, so the "Switch plans" button painted with the wrong label and then shifted into place.
  • Payment methods: the loader reserves the row + add-button height instead of collapsing to the spinner size.

Domains BEFORE

before.mov

Domains AFTER

after.mov

Billing BEFORE

billing-before.mov

Billing AFTER

billing-after.mov

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Bug Fixes
    • Reduced layout shifting while organization and billing information loads.
    • Added consistent reserved space and loading indicators for subscription details and payment methods.
    • Improved the domain list loading state to provide a smoother visual transition.
    • Subscription actions and content now appear more predictably as data becomes available.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jul 15, 2026 1:42pm
swingset Ready Ready Preview, Comment Jul 15, 2026 1:42pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae57ca4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The UI loading states now reserve space for domain lists, payment methods, and subscriptions. Subscription loading displays a full-height loader before subscription content and actions, while the domain spinner container uses reduced spacing.

Changes

Loading layout stabilization

Layer / File(s) Summary
Reserved loading containers
packages/ui/src/components/OrganizationProfile/DomainList.tsx, packages/ui/src/components/PaymentMethods/PaymentMethods.tsx
The domain spinner uses t.space.$8, and payment method loading wraps FullHeightLoader in a fixed-height Box.
Subscription loading flow
packages/ui/src/components/Subscriptions/SubscriptionsList.tsx, .changeset/fix-loading-shift.md
Subscriptions render a reserved-height loader while initially loading, then display the table and action buttons; the changeset records a patch release.
Estimated code review effort: 2 (Simple) ~10 minutes

Possibly related PRs

  • clerk/javascript#9147: Updates the core spinner primitive’s box sizing while this PR adjusts loading containers.

Poem

A rabbit saw loaders stand tall,
Reserving a place in the hall.
Domains, cards, plans in a row,
No sudden layout shifts below.
“Hop hooray!” the spinner sings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main UI change: reducing loading layout shifts in domain and billing sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-15T13:49:20.209Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on ae57ca4.

@pkg-pr-new

pkg-pr-new Bot commented Jul 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9169

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9169

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9169

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9169

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9169

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9169

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9169

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9169

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9169

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9169

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9169

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9169

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9169

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9169

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9169

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9169

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9169

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9169

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9169

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9169

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9169

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9169

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9169

commit: ae57ca4

@alexcarpenter alexcarpenter changed the title fix(ui): Avoid domain loading shift fix(ui): Avoid domain and billing loading shifts Jul 15, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/src/components/PaymentMethods/PaymentMethods.tsx`:
- Around line 145-147: Update the loading branches in
packages/ui/src/components/PaymentMethods/PaymentMethods.tsx (lines 145-147) and
packages/ui/src/components/Subscriptions/SubscriptionsList.tsx (lines 97-102) to
reserve space matching their loaded content: include all payment-method rows and
the add action in PaymentMethods, and multiple subscription, seat, overview, and
action rows in SubscriptionsList. Replace the fixed-height loaders with
appropriately sized skeleton structures or dynamic reserved layouts to prevent
layout shifts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 356d49c0-ff2f-4190-a345-177cd1cacd2d

📥 Commits

Reviewing files that changed from the base of the PR and between 01a1682 and ae57ca4.

📒 Files selected for processing (3)
  • .changeset/fix-loading-shift.md
  • packages/ui/src/components/PaymentMethods/PaymentMethods.tsx
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx

Comment on lines +145 to +147
<Box sx={t => ({ height: t.space.$16 })}>
<FullHeightLoader />
</Box>

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Fixed loading heights do not match variable loaded content.

Both loaders can still cause layout shifts because their loaded branches render variable numbers of rows and actions.

  • packages/ui/src/components/PaymentMethods/PaymentMethods.tsx#L145-L147: reserve space for all payment-method rows and the add action, or use a matching skeleton structure.
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx#L97-L102: account for multiple subscription, seat, overview, and action rows instead of reserving one fixed card height.
📍 Affects 2 files
  • packages/ui/src/components/PaymentMethods/PaymentMethods.tsx#L145-L147 (this comment)
  • packages/ui/src/components/Subscriptions/SubscriptionsList.tsx#L97-L102
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/PaymentMethods/PaymentMethods.tsx` around lines
145 - 147, Update the loading branches in
packages/ui/src/components/PaymentMethods/PaymentMethods.tsx (lines 145-147) and
packages/ui/src/components/Subscriptions/SubscriptionsList.tsx (lines 97-102) to
reserve space matching their loaded content: include all payment-method rows and
the add action in PaymentMethods, and multiple subscription, seat, overview, and
action rows in SubscriptionsList. Replace the fixed-height loaders with
appropriately sized skeleton structures or dynamic reserved layouts to prevent
layout shifts.

@maxyinger maxyinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this has been on my list. Nice work!

@alexcarpenter alexcarpenter merged commit 027dc06 into main Jul 15, 2026
89 of 90 checks passed
@alexcarpenter alexcarpenter deleted the carp/fix-domain-loading-shift branch July 15, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants