Keep old count visible until new rows arrive

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) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-05-22 12:37:25 +02:00
parent 11c225cb68
commit 470b1ce4d5
@@ -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(