Skip to content

fix(settings): stop the infra-billing page rendering permanently in deselected-sites state - #6161

Merged
pedrofrxncx merged 1 commit into
mainfrom
fix/infra-billing-empty-selection-stuck-loading-w1
Aug 18, 2026
Merged

fix(settings): stop the infra-billing page rendering permanently in deselected-sites state#6161
pedrofrxncx merged 1 commit into
mainfrom
fix/infra-billing-empty-selection-stuck-loading-w1

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Follows up on the recently-added infra-billing UI (apps/web/src/views/settings/infra-billing.tsx, apps/web/src/hooks/use-infra-billing.ts).

The bug: useInfraBilling's query is enabled: slugs.length > 0. When a user deselects every site in the MultiSelect, narrowedTo becomes [] (not null), so selected is [] and the query stays disabled forever — data never resolves and isLoading never becomes true. Two visible consequences on the page:

  1. The billing summary card falls into the !isLoading branch and renders billingMessage, which defaults to the "multiple_teams" key when data?.billingUnavailableReason is undefined — showing a wrong "sites belong to different legacy teams" message even though the real cause is just an empty selection.
  2. The invoices table's !data check renders a <Skeleton> that never resolves — a permanent loading spinner.

The fix: skip the summary/metrics/invoices SettingsSections entirely when selected.length === 0 — the existing pickASite card above already covers that state, so there's nothing else to show.

Reviewer check: open Settings > Infra Billing with an org that owns 2+ sites, then clear the site MultiSelect down to zero selections — confirm only the "pick a site" card shows, with no stuck skeleton or wrong billing message underneath.

Verified locally: bun run fmt, cd apps/web && bunx tsc --noEmit (green), bunx oxlint apps/web/src/views/settings/infra-billing.tsx (0 warnings/errors). No existing unit test covers this React view; full CI validates the rest.


Summary by cubic

Prevents stuck loading and wrong messaging on Infra Billing when the site selection is empty. Previously, deselecting all sites left the query disabled, showed a misleading “multiple teams” message, and kept the invoices table skeleton visible; now the summary, metrics, and invoices sections are hidden when no sites are selected so only the “pick a site” card remains.

  • Reviewer notes:
    • In Settings > Infra Billing, clear the site MultiSelect to zero selections. Confirm only the “pick a site” card shows, with no skeletons or billing message underneath.
    • Change is isolated to apps/web/src/views/settings/infra-billing.tsx: the summary/metrics/invoices SettingsSections render only when selected.length > 0.

Written for commit 585f89a. Summary will update on new commits.

Review in cubic

…eselected-sites state

Deselecting every site in the MultiSelect sets narrowedTo to [], not null, so
selected.length becomes 0 and useInfraBilling's query stays disabled forever
(enabled: slugs.length > 0). data never resolves and isLoading never becomes
true, so:
- the billing summary card falls into the !isLoading branch and shows
  billingMessage, which defaults to the 'multiple_teams' wording since
  data?.billingUnavailableReason is undefined — a wrong error message.
- the invoices table's !data check renders a Skeleton that never resolves.

Skip the summary/metrics/invoices sections entirely when nothing is selected;
the pickASite card above already covers that state.
@pedrofrxncx
pedrofrxncx enabled auto-merge (squash) August 18, 2026 14:09
@pedrofrxncx
pedrofrxncx merged commit c915ed7 into main Aug 18, 2026
25 checks passed
@pedrofrxncx
pedrofrxncx deleted the fix/infra-billing-empty-selection-stuck-loading-w1 branch August 18, 2026 14:10
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