Preserve kind casing in table title during transitions
Use the filter's label (which has proper casing like "AiResources") when it matches the displayed entities. Fall back to the entity's kind field directly instead of lowercasing and re-capitalizing, which mangled camelCase kinds like AiResource into Airesource. 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:
@@ -196,12 +196,14 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
|
||||
// Derive the title's kind label from the displayed entities so the
|
||||
// title stays consistent with the rows during filter transitions.
|
||||
const displayedKind =
|
||||
entities[0]?.kind?.toLocaleLowerCase('en-US') ?? filters.kind?.value;
|
||||
// Use the filter's label when it matches (it has proper casing),
|
||||
// otherwise fall back to the entity's kind field directly.
|
||||
const displayedKind = entities[0]?.kind ?? filters.kind?.value;
|
||||
const displayedKindLabel =
|
||||
displayedKind === filters.kind?.value?.toLocaleLowerCase('en-US')
|
||||
displayedKind?.toLocaleLowerCase('en-US') ===
|
||||
filters.kind?.value?.toLocaleLowerCase('en-US')
|
||||
? filters.kind?.label || ''
|
||||
: capitalize(displayedKind || '');
|
||||
: displayedKind || '';
|
||||
const currentType = filters.type?.value || '';
|
||||
const countIsCorrect =
|
||||
typeof totalItems === 'number' && !totalItemsLoading && !loading;
|
||||
|
||||
Reference in New Issue
Block a user