From 330d39bd29858abf876c245791386beec74b783a Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Thu, 23 Jul 2026 19:42:17 +0530 Subject: [PATCH] fix(dashboard): send double-nested pagination in OrgDomains' list query ListOrgDomainsRequest.pagination is PaginatedRequest, which itself wraps a `pagination: PaginationRequest` field (internal/graph/schema.graphqls) - fetchDomains sent the single-nested `pagination: { limit: 100 }`, which the server rejected on every call with GRAPHQL_VALIDATION_FAILED. The error was silently swallowed (`res.data?._org_domains?.org_domains || []` never checked res.error), so the verified-domains table always rendered "No verified domains yet." even when domains existed - this feature (added in #707) has never worked since it shipped. Also adds the missing res.error handling fetchDomains lacked, matching every other mutation handler in this file, and a regression test asserting the exact query variable shape sent (the existing test file's generic client mock never validated variable shape against a real schema, which is why this went unnoticed by the pre-existing unit tests). Found while building an e2e spec to drive this UI through a real browser and backend. --- .../src/components/OrgDomains.test.tsx | 22 +++++++++++++++++++ web/dashboard/src/components/OrgDomains.tsx | 12 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/web/dashboard/src/components/OrgDomains.test.tsx b/web/dashboard/src/components/OrgDomains.test.tsx index 95b1fbb2..b7458f5e 100644 --- a/web/dashboard/src/components/OrgDomains.test.tsx +++ b/web/dashboard/src/components/OrgDomains.test.tsx @@ -86,6 +86,28 @@ describe('OrgDomains', () => { expect(await screen.findByText('acme.com')).toBeTruthy(); }); + // REGRESSION: ListOrgDomainsRequest.pagination is PaginatedRequest, which + // itself wraps a `pagination: PaginationRequest` field + // (internal/graph/schema.graphqls) - fetchDomains used to send + // `pagination: { limit: 100 }` (single-nested), which the server rejected + // with GRAPHQL_VALIDATION_FAILED on every call. The mock client here + // doesn't validate variable shape against a real schema, so this bug was + // invisible to every other test in this file - assert the exact shape + // directly instead. + it('requests domains with the double-nested pagination shape the schema requires', async () => { + render(); + await screen.findByText('No verified domains yet.'); + expect(mockClient.query).toHaveBeenCalledWith( + expect.anything(), + expect.objectContaining({ + params: { + org_id: 'org1', + pagination: { pagination: { limit: 100 } }, + }, + }), + ); + }); + it('runs the DNS challenge flow: request → shows TXT → verify → verified', async () => { mockClient.mutation.mockImplementation((doc: unknown) => { if (doc === RequestOrgDomain) { diff --git a/web/dashboard/src/components/OrgDomains.tsx b/web/dashboard/src/components/OrgDomains.tsx index 16c64e22..a859628b 100644 --- a/web/dashboard/src/components/OrgDomains.tsx +++ b/web/dashboard/src/components/OrgDomains.tsx @@ -110,9 +110,19 @@ const OrgDomains = ({ orgId, orgSlug }: OrgDomainsProps) => { // Verified domains per org are expected to be a handful at most; a // generous single-page limit avoids silently truncating at the // backend's default of 10 without needing full pagination UI. - params: { org_id: orgId, pagination: { limit: 100 } }, + // ListOrgDomainsRequest.pagination is PaginatedRequest, which itself + // wraps a `pagination: PaginationRequest` field - double-nested, not + // { limit } directly (internal/graph/schema.graphqls). + params: { org_id: orgId, pagination: { pagination: { limit: 100 } } }, }) .toPromise(); + if (res.error) { + toast.error( + capitalizeFirstLetter( + getGraphQLErrorMessage(res.error, 'Failed to load verified domains'), + ), + ); + } setDomains(res.data?._org_domains?.org_domains || []); setDomainsLoading(false); };