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): separate a failed account load from an empty account list (#99690)

Tom Owersb31e8d53a0f4
diff --git a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.test.tsx b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.test.tsx
new file mode 100644
index 000000000000..ac7cb00ce309
--- /dev/null
+++ b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.test.tsx
@@ -0,0 +1,12 @@
+import { accountsDropdownEmptyMessage } from './IntegrationAccountSelector'
+
+describe('IntegrationAccountSelector', () => {
+ // A failed listing request leaves the same empty list as a connection that reaches no accounts,
+ // and the picker used to report both as the second one.
+ it('separates a failed account listing from a connection with no accounts', () => {
+ expect(accountsDropdownEmptyMessage('Reconnect your Google account.')).not.toEqual(
+ accountsDropdownEmptyMessage(null)
+ )
+ expect(accountsDropdownEmptyMessage(null)).toContain('No accounts accessible')
+ })
+})
diff --git a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
index d512c320c4b2..ccd646463b25 100644
--- a/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/IntegrationAccountSelector.tsx
@@ -88,6 +88,15 @@ export function normalizeMultiValue(value: unknown, legacySingle?: unknown): str
return normalized
}
+/** What the picker's dropdown says when it has no accounts to list. A failed listing request also
+ * leaves the list empty, and claiming the connection reaches no accounts sends the user to fix
+ * permissions they never lost. */
+export function accountsDropdownEmptyMessage(accountsError: string | null): string {
+ return accountsError
+ ? "Couldn't load your accounts. Reconnect the integration, or type the value in above."
+ : 'No accounts accessible by this integration.'
+}
+
/** Generic account/resource picker for OAuth ad sources: a dropdown of the connected integration's
* accounts (shared IntegrationAccount contract), falling back to a text input until one is connected. */
export function IntegrationAccountSelector(props: IntegrationAccountSelectorProps): JSX.Element {
@@ -496,7 +505,7 @@ function IntegrationAccountFieldWithDropdown({
suggestionsLoading={accountsLoading}
onSearchChange={setSearch}
searchPlaceholder="Filter accounts…"
- emptyMessage="No accounts accessible by this integration."
+ emptyMessage={accountsDropdownEmptyMessage(accountsError)}
noMatchMessage={() =>
'No accounts match your filter. Clear it to see every account this connection can reach.'
}