From a444c7431a5938124328e35069d43ce640a0aecd Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Tue, 29 Jun 2021 14:36:35 -0400 Subject: [PATCH] feat(techdocs): filter fetched entity kinds and fields Signed-off-by: Phil Kuang --- .changeset/smooth-planes-mate.md | 5 +++++ plugins/techdocs/src/home/components/TechDocsCustomHome.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/smooth-planes-mate.md diff --git a/.changeset/smooth-planes-mate.md b/.changeset/smooth-planes-mate.md new file mode 100644 index 0000000000..7d2eb897de --- /dev/null +++ b/.changeset/smooth-planes-mate.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Filter fetched entity fields to optimize loading techdocs list diff --git a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx index 9b106c94ce..90b968de6c 100644 --- a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx +++ b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx @@ -124,7 +124,9 @@ export const TechDocsCustomHome = ({ const configApi: ConfigApi = useApi(configApiRef); const { value: entities, loading, error } = useAsync(async () => { - const response = await catalogApi.getEntities(); + const response = await catalogApi.getEntities({ + fields: ['apiVersion', 'kind', 'metadata', 'spec.owner', 'spec.type'], + }); return response.items.filter((entity: Entity) => { return !!entity.metadata.annotations?.['backstage.io/techdocs-ref']; });