Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): surface empty account state in oauth source picker (#72471)

Tom Owers1fd97dcb9a75
diff --git a/frontend/src/lib/integrations/integrationAccountsLogic.ts b/frontend/src/lib/integrations/integrationAccountsLogic.ts
index 482a39cf1ccf..3bb311fe9042 100644
--- a/frontend/src/lib/integrations/integrationAccountsLogic.ts
+++ b/frontend/src/lib/integrations/integrationAccountsLogic.ts
@@ -12,6 +12,7 @@ const SEARCH_DEBOUNCE_MS = 300
export interface integrationAccountsLogicValues {
accounts: IntegrationAccountApi[]
accountsError: string | null
+ accountsLoaded: boolean
accountsLoading: boolean
search: string
}
@@ -88,6 +89,15 @@ export const integrationAccountsLogic = kea<integrationAccountsLogicType>([
reducers({
search: ['', { setSearch: (_, { search }) => search }],
+ // Whether a load has finished at least once, so the UI can distinguish "not fetched yet" from
+ // "fetched and genuinely empty" without flashing an empty state on first paint.
+ accountsLoaded: [
+ false,
+ {
+ loadAccountsSuccess: () => true,
+ loadAccountsFailure: () => true,
+ },
+ ],
// Surface the backend's actionable 400 message (e.g. "reconnect the integration") instead of
// falling back to a generic "no accounts" empty state. Cleared when a fresh load starts or succeeds.
accountsError: [
diff --git a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
index a1c8244b4051..0e5e877c8416 100644
--- a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
@@ -344,7 +344,7 @@ function IntegrationAccountFieldWithDropdown({
placeholder,
caption,
}: IntegrationAccountSelectorProps & { integrationId: number }): JSX.Element {
- const { accounts, accountsLoading, accountsError } = useValues(
+ const { accounts, accountsLoading, accountsLoaded, accountsError } = useValues(
integrationAccountsLogic({ id: integrationId, sourceType })
)
const { loadAccounts, setSearch } = useActions(integrationAccountsLogic({ id: integrationId, sourceType }))
@@ -399,6 +399,12 @@ function IntegrationAccountFieldWithDropdown({
loadingMessage="Loading accounts…"
/>
{accountsError && <p className="m-0 text-xs text-warning">{accountsError}</p>}
+ {accountsLoaded && !accountsLoading && !accountsError && accounts.length === 0 && (
+ <p className="m-0 text-xs text-warning">
+ No accounts are accessible for this connection. Check that the connected account has the
+ right permissions, then reconnect the integration.
+ </p>
+ )}
{savedValueMissing && (
<p className="m-0 text-xs text-warning">
The currently saved {fieldLabel} <code>{value}</code> isn't in the accessible list for