catalog-client: getEntitiesByRefs should return undefined
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/catalog-client': patch
|
||||
---
|
||||
|
||||
Ensure that `getEntitiesByRefs` returns `undefined` instead of `null` for missing items
|
||||
@@ -249,7 +249,7 @@ describe('CatalogClient', () => {
|
||||
{ token },
|
||||
);
|
||||
|
||||
expect(response).toEqual({ items: [entity, null] });
|
||||
expect(response).toEqual({ items: [entity, undefined] });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -199,9 +199,11 @@ export class CatalogClient implements CatalogApi {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
}
|
||||
|
||||
const { items } = await response.json();
|
||||
const { items } = (await response.json()) as {
|
||||
items: Array<Entity | null>;
|
||||
};
|
||||
|
||||
return { items };
|
||||
return { items: items.map(i => i ?? undefined) };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user