Update CatalogTable to default total count to 0 instead of undefined

Depending on latency in making the request the context can load without items and then refresh moments later with the correct count. Until the entities are loaded the total will show as "All (undefined)", which is not confidence inspiring.

Signed-off-by: CiscoRob <133238823+CiscoRob@users.noreply.github.com>
Signed-off-by: Coderrob <rolindle@cisco.com>
This commit is contained in:
CiscoRob
2024-04-06 14:38:20 -05:00
committed by Coderrob
parent cb02bb5763
commit fade5e020f
@@ -88,10 +88,15 @@ export const CatalogTable = (props: CatalogTableProps) => {
} = props;
const { isStarredEntity, toggleStarredEntity } = useStarredEntities();
const entityListContext = useEntityList();
const { loading, error, entities, filters, pageInfo, totalItems } =
entityListContext;
const {
loading,
error,
entities,
filters,
pageInfo,
totalItems = 0,
} = entityListContext;
const enablePagination = !!pageInfo;
const tableColumns = useMemo(
() =>
typeof columns === 'function' ? columns(entityListContext) : columns,