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); };