fix(settings): don't hide the infra tab while owned-sites is still loading - #6361
Merged
Merged
Conversation
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.
Bug found while reviewing the org-settings tab strip (
use-settings-tabs.ts), the same flicker family as #6340.useVisibleSettingsTabsgates the Billing group's "Infrastructure" tab onrequiresOwnedSites, readinguseOwnedSites().sites.length > 0directly.useOwnedSitesis a plainuseQuerythat starts withdataundefined, sositesis[]until the request resolves — on every settings page load, an org that actually owns legacy sites momentarily has the tab hidden, then it pops in once the query completes. The capability-gated tabs already avoid this exact flicker via an explicitloadingcheck (see the hook's own doc comment: "Mirrors the sidebar's optimistic-while-loading rule... so owners never see the tab strip flicker") — the owned-sites gate was just never wired into that rule.Fix: destructure
isLoadingfromuseOwnedSites()and don't hide the tab while it's still loading, matching the capabilities gate below it.Failure scenario: an org that owns a legacy deco.cx site opens Settings → Billing; the "Infrastructure" tab is briefly absent from the tab strip, then appears once
INFRA_BILLING_SITES_LISTresolves — a visible layout shift on a page that otherwise (post #6340) is supposed to stay stable while tabs load.Reviewer check:
cd apps/web && bunx tsc --noEmit(green). No test added — this is a plain react-query-derived boolean with no branch worth mocking a query client for; behavior is directly readable from the diff.Locally ran:
bun run fmt,bunx tsc --noEmit(apps/web),bunx oxlinton the changed file — all clean. Full CI (lint, unit, e2e) validates the rest.Summary by cubic
Stop hiding the Billing “Infrastructure” tab while owned sites are still loading to eliminate a first-render flicker. Previously the tab was hidden until
useOwnedSitesresolved (empty array by default); now it stays visible during loading and hides only if the loaded result has no owned sites.Reviewer notes
requiresOwnedSitesremain visible whileuseOwnedSitesis loading; they hide only after load confirms no sites, matching the capabilities gate and preventing layout shift on Settings → Billing.Written for commit e2b6e31. Summary will update on new commits.