diff --git a/.changeset/eight-trainers-smoke.md b/.changeset/eight-trainers-smoke.md new file mode 100644 index 0000000000..4c3cd33fbb --- /dev/null +++ b/.changeset/eight-trainers-smoke.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-client': patch +--- + +Fixed bug in `queryEntities` of `CatalogClient` where the `sortField` is supposed to be changed to `orderField`. diff --git a/packages/catalog-client/src/CatalogClient.test.ts b/packages/catalog-client/src/CatalogClient.test.ts index 53bb55b95f..f5c221569d 100644 --- a/packages/catalog-client/src/CatalogClient.test.ts +++ b/packages/catalog-client/src/CatalogClient.test.ts @@ -352,7 +352,7 @@ describe('CatalogClient', () => { ], }); expect(mockedEndpoint.mock.calls[0][0].url.search).toBe( - '?limit=100&sortField=metadata.name,asc&sortField=metadata.uid,desc&fields=a,b&fullTextFilterTerm=query', + '?limit=100&orderField=metadata.name,asc&orderField=metadata.uid,desc&fields=a,b&fullTextFilterTerm=query', ); }); diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index be4ae6289d..c388519e05 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -230,7 +230,7 @@ export class CatalogClient implements CatalogApi { } if (orderFields !== undefined) { (Array.isArray(orderFields) ? orderFields : [orderFields]).forEach( - ({ field, order }) => params.push(`sortField=${field},${order}`), + ({ field, order }) => params.push(`orderField=${field},${order}`), ); } if (fields.length) {