From 470b1ce4d588049d203dc1cd3c841028cc3f6c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 22 May 2026 12:37:25 +0200 Subject: [PATCH] Keep old count visible until new rows arrive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show the previous count alongside the spinner during loading. Only hide the count when new rows have arrived but the count hasn't caught up yet (would be wrong for the new data). This makes the only immediate visual change after a filter switch the spinner appearing. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Fredrik Adelöw --- .../catalog/src/components/CatalogTable/CatalogTable.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx index af49c0b48c..801b1ffd17 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx @@ -205,9 +205,12 @@ export const CatalogTable = (props: CatalogTableProps) => { ? filters.kind?.label || '' : displayedKind || ''; const currentType = filters.type?.value || ''; - const countIsCorrect = - typeof totalItems === 'number' && !totalItemsLoading && !loading; - const currentCount = countIsCorrect ? ` (${totalItems})` : ''; + // Show the count as long as we have one. Hide it only when new rows + // have arrived but the count hasn't caught up yet — at that point + // the old count would be wrong for the new data. + const countIsStale = !loading && totalItemsLoading; + const currentCount = + typeof totalItems === 'number' && !countIsStale ? ` (${totalItems})` : ''; const somethingIsLoading = loading || totalItemsLoading; // TODO(timbonicus): remove the title from the CatalogTable once using EntitySearchBar const titlePreamble = capitalize(