fix(settings): stop the infra-billing page rendering permanently in deselected-sites state - #6161
Merged
pedrofrxncx merged 1 commit intoAug 18, 2026
Conversation
…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
enabled auto-merge (squash)
August 18, 2026 14:09
pedrofrxncx
deleted the
fix/infra-billing-empty-selection-stuck-loading-w1
branch
August 18, 2026 14:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 isenabled: slugs.length > 0. When a user deselects every site in theMultiSelect,narrowedTobecomes[](notnull), soselectedis[]and the query stays disabled forever —datanever resolves andisLoadingnever becomestrue. Two visible consequences on the page:!isLoadingbranch and rendersbillingMessage, which defaults to the"multiple_teams"key whendata?.billingUnavailableReasonisundefined— showing a wrong "sites belong to different legacy teams" message even though the real cause is just an empty selection.!datacheck renders a<Skeleton>that never resolves — a permanent loading spinner.The fix: skip the summary/metrics/invoices
SettingsSections entirely whenselected.length === 0— the existingpickASitecard 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.
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.apps/web/src/views/settings/infra-billing.tsx: the summary/metrics/invoicesSettingsSections render only whenselected.length > 0.Written for commit 585f89a. Summary will update on new commits.