From 87727f50db1893a34a6ff97ff71c7af176b8e3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 22 May 2026 12:31:29 +0200 Subject: [PATCH] Derive column layout from displayed entities, not filter state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The column set (System, Owner, Type, etc.) now stays consistent with the displayed rows during kind filter transitions, same as the name column's defaultKind. The switch statement uses the entity-derived kind so columns don't jump until new data actually arrives. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Fredrik Adelöw --- .../components/CatalogTable/CatalogTable.test.tsx | 6 +++++- .../defaultCatalogTableColumnsFunc.tsx | 15 +++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx index 76a6c35b35..df796ff321 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx @@ -295,11 +295,15 @@ describe('CatalogTable component', () => { ])( 'should render correct columns with kind filter $kind', async ({ kind, expectedColumns }) => { + const kindEntities = entities.map(e => ({ + ...e, + kind: kind ?? e.kind, + })); await renderInTestApp( { - // Derive the name column's defaultKind from the displayed entities so - // that the entity ref prefix stays consistent with the rows during - // filter transitions (when stale rows are kept visible while new data - // loads). The column layout switch still uses the filter's kind so the - // table shape updates immediately. - const defaultKind = + // Derive the effective kind from the displayed entities so that both + // the column layout and the name column's defaultKind stay consistent + // with the rows during filter transitions (when stale rows are kept + // visible while new data loads). + const effectiveKind = entities[0]?.kind?.toLocaleLowerCase('en-US') ?? filters.kind?.value; const showTypeColumn = filters.type === undefined; return [ columnFactories.createTitleColumn({ hidden: true }), - columnFactories.createNameColumn({ defaultKind }), + columnFactories.createNameColumn({ defaultKind: effectiveKind }), ...createEntitySpecificColumns(), ]; @@ -51,7 +50,7 @@ export const defaultCatalogTableColumnsFunc: CatalogTableColumnsFunc = ({ columnFactories.createSpecTypeColumn({ hidden: !showTypeColumn }), columnFactories.createSpecLifecycleColumn(), ]; - switch (filters.kind?.value) { + switch (effectiveKind) { case 'user': return [...descriptionTagColumns]; case 'domain':