Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions web/dashboard/src/components/OrgDomains.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<OrgDomains orgId="org1" orgSlug="Acme" />);
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) {
Expand Down
12 changes: 11 additions & 1 deletion web/dashboard/src/components/OrgDomains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down