From 54faebdc863202018643d96f622804605072fb54 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 14:07:28 +0000 Subject: [PATCH 1/2] fix(list): a hosted data-laned board's footer counts the whole query, as its lanes do Claude-Session: https://claude.ai/code/session_01JQwxbamiNxp7695qyaEYsH Co-authored-by: Claude --- ui/packages/plugin-list/src/ListView.tsx | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/ui/packages/plugin-list/src/ListView.tsx b/ui/packages/plugin-list/src/ListView.tsx index f3b0ce00c0d..fd378a93780 100644 --- a/ui/packages/plugin-list/src/ListView.tsx +++ b/ui/packages/plugin-list/src/ListView.tsx @@ -4077,6 +4077,27 @@ export const ListView = React.forwardRef(({ listFetchesForItself && !!schema.objectName && typeof dataSource?.find === 'function'; + /** + * objectstack#38558 — can the board handed this component's window reach + * every record of the view on its own? It can where its lanes come from the + * data, flat, over a lookup or a text lane field, and the source has the + * grouped-aggregate door: the board's lane read then draws a lane for every + * value of the query, a lane past the page included, and each lane loads its + * records past the page itself ("Load more", objectstack#37327, + * objectstack#38120, objectstack#38506). The footer then says no + * "Showing first N": the board is not a window. Any other lane field (a + * number, boolean or date field), declared lanes or swimlanes draw the + * page's lanes only, so the line stays. + */ + const kanbanLaneFieldDef: { type?: unknown; reference?: unknown } | undefined = + kanbanLaneField ? objectDef?.fields?.[kanbanLaneField] : undefined; + const kanbanHostedBoardReachesEveryRecord = + kanbanLaneStatisticHosted && + ((typeof kanbanLaneFieldDef?.reference === 'string' && kanbanLaneFieldDef.reference !== '') || + kanbanLaneFieldDef?.type === 'text') && + !kanbanDeclaredLanes(kanbanBlockOf(schema).lanes, undefined) && + !(groupingConfig?.fields?.length) && + typeof dataSource?.queryGroupHeaders === 'function'; /** * The calendar's date bindings, for the fetch effect's window @@ -7088,8 +7109,17 @@ export const ListView = React.forwardRef(({ // objectstack#35702 — a grid that draws its resident footer row says the // count there, in its first cell; the bar keeps only the cap warning. const recordCountTextShown = recordCountShown && !(currentView === 'grid' && gridDrawsCount); + // objectstack#38558 — the board handed this component's window counts each + // lane over the whole query, so the footer counts the whole query too: the + // total this component's own query answered, not the window's length. The + // "Showing first N" line goes only where the board reaches every record + // itself (`kanbanHostedBoardReachesEveryRecord`). + const hostedBoardTotal: number | null = + kanbanLaneStatisticHosted && typeof fetchedTotal === 'number' ? fetchedTotal : null; + const recordCountFigure = hostedBoardTotal ?? serverTotal ?? data.length; const dataLimitWarningShown = - recordCountShown && dataLimitReached && !(paginate && serverTotal != null) && !infiniteScroll; + recordCountShown && dataLimitReached && !(paginate && serverTotal != null) && !infiniteScroll && + !(hostedBoardTotal !== null && kanbanHostedBoardReachesEveryRecord); // objectui#12619 — a board that pages its own lanes draws every record of the // view, a page per lane at a time, so the footer counts the VIEW: the total // this component's own query answered, which is the sum of the board's lane @@ -7102,7 +7132,7 @@ export const ListView = React.forwardRef(({ const leadingRecordCount: number | null = boardRecordCountShown ? (fetchedTotal as number) : !loading && surfaceDrawsFetchedRows && schema.showRecordCount !== false && !calendarWindowed && !kanbanLanesPaged - ? (serverTotal ?? data.length) + ? recordCountFigure : null; const drawnToolbarLeading = typeof toolbarLeading === 'function' ? toolbarLeading({ recordCount: leadingRecordCount, layout: currentView }) @@ -9107,7 +9137,7 @@ export const ListView = React.forwardRef(({ view's total. */} {calendarWindowed ? t('list.calendarRecordCount', { count: data.length }) - : t('list.recordCount', { count: serverTotal ?? data.length })} + : t('list.recordCount', { count: recordCountFigure })} )} {/* The cap warning is about rows the user CANNOT REACH. A paged grid From e4b485a51ae000b22eb2c476238eb83d0b297c9b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 14:10:26 +0000 Subject: [PATCH 2/2] test(kanban): pin the data-laned board footer to the whole query count; changeset Claude-Session: https://claude.ai/code/session_01JQwxbamiNxp7695qyaEYsH Co-authored-by: Claude --- .changeset/38558-kanban-footer-count.md | 8 ++ .../listKanbanEveryRecord-12619.test.tsx | 120 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 .changeset/38558-kanban-footer-count.md diff --git a/.changeset/38558-kanban-footer-count.md b/.changeset/38558-kanban-footer-count.md new file mode 100644 index 00000000000..ebddb26c6d8 --- /dev/null +++ b/.changeset/38558-kanban-footer-count.md @@ -0,0 +1,8 @@ +--- +'@object-ui/plugin-list': patch +--- + +Clause-②: no +Metadata-protocol: none + +A kanban board under a list view whose lanes come from the data (a lookup or text lane field) now shows the view's full record count in its footer, the same count its lanes add up to. Before, the footer counted only the first page handed to the board ("25 records" plus "Showing first 25 records") while the lanes counted every record (70). The "Showing first N" line now appears only on boards that draw only the first page's lanes (number, boolean or date lane fields, declared lanes, swimlanes, or a source with no grouped read). diff --git a/ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx b/ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx index 29afa04bd2f..cf36ab1af45 100644 --- a/ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx +++ b/ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx @@ -1022,3 +1022,123 @@ describe('a lookup-laned board under a list view counts and totals each whole la expect(headerTotal('acc-b')).toBe('0.7'); }); }); + +/** + * objectstack#38558 — the footer of a board handed the list's window counts + * what its lanes count: the whole query. Each lane badge of a data-laned + * board counts its whole lane (objectstack#37327), so a footer that counted + * the window ("25 records" plus "Showing first 25 records") read against + * lanes adding up to 70. The footer now states the query's total; the + * "Showing first N" line goes only where the board reaches every record + * itself (a lookup or text lane field, flat lanes, the grouped door), and + * stays where it draws the page's lanes only. + */ +describe('a data-laned board under a list view: the footer counts the whole query, as the lanes do (objectstack#38558)', () => { + const DEAL = 'crm_deal'; + const ACCOUNT = 'crm_account'; + /** 70 deals: 30 + 30 on the first pages, the last 10 in a third lane past page one. */ + const DEALS: Row[] = Array.from({ length: 70 }, (_, i) => ({ + id: `deal-${String(i).padStart(2, '0')}`, + name: `Deal ${String(i).padStart(2, '0')}`, + account: i >= 60 ? 'acc-c' : i % 2 === 0 ? 'acc-a' : 'acc-b', + tier: i >= 60 ? 'bronze' : i % 2 === 0 ? 'gold' : 'silver', + rank: i >= 60 ? 3 : i % 2 === 0 ? 1 : 2, + })); + const DEFS: Record = { + [DEAL]: { + name: DEAL, + label: 'Deal', + fields: { + name: { type: 'text', label: 'Deal Name' }, + account: { type: 'lookup', label: 'Account', reference: ACCOUNT }, + tier: { type: 'text', label: 'Tier' }, + rank: { type: 'number', label: 'Rank' }, + }, + }, + [ACCOUNT]: { name: ACCOUNT, label: 'Account', nameField: 'name', fields: { name: { type: 'text', label: 'Name' } } }, + }; + const ACCOUNTS: Row[] = [ + { id: 'acc-a', name: 'Amber Ltd' }, + { id: 'acc-b', name: 'Birch Inc' }, + { id: 'acc-c', name: 'Cyan Corp' }, + ]; + const boardView = (groupByField: string) => ({ + type: 'list-view', + objectName: DEAL, + viewType: 'kanban', + columns: [{ field: 'name' }, { field: groupByField }], + pagination: { pageSize: 25 }, + kanban: { groupByField, titleField: 'name' }, + }); + + /** A source answering `total`, with (or without) the grouped door counting each group. */ + function countSource(door = true) { + const stores: Record> = { + [DEAL]: new ValueDataSource({ items: DEALS }), + [ACCOUNT]: new ValueDataSource({ items: ACCOUNTS }), + }; + const queryGroupHeaders = vi.fn(async (object: string, query: any) => { + const kept = (await stores[object].find(object, { ...(query.where ? { $filter: query.where } : {}), $top: 100000 } as any)) as any; + const rows: Row[] = Array.isArray(kept) ? kept : kept.data ?? kept.records ?? []; + const key = query.groupBy[0]; + const groups = new Map(); + for (const row of rows) groups.set(row[key] ?? null, (groups.get(row[key] ?? null) ?? 0) + 1); + return [...groups].map(([k, n]) => { + const out: Row = { [key]: k }; + for (const agg of query.aggregations) out[agg.alias] = agg.function === 'count' ? n : null; + return out; + }); + }); + return { + find: vi.fn(async (object: string, params: any) => stores[object].find(object, params)), + findOne: vi.fn(), + create: vi.fn(), + update: vi.fn(), + delete: vi.fn(), + getObjectSchema: vi.fn(async (object: string) => DEFS[object]), + ...(door ? { queryGroupHeaders } : {}), + } as any; + } + + const laneBadge = (title: string) => + (within(lane(title)).getByRole('heading').parentElement!.querySelector('span')!.textContent ?? '').trim(); + const footer = () => screen.getByTestId('record-count-bar'); + + it('a text-laned board: the footer reads 70 records, the sum of its lanes 30 + 30 + 10, and no "Showing first 25"', async () => { + mountBoard(countSource(), boardView('tier')); + + await waitFor(() => expect(cards()).toHaveLength(25)); + await waitFor(() => expect(laneBadge('bronze')).toBe('10')); + const laneSum = Number(laneBadge('gold')) + Number(laneBadge('silver')) + Number(laneBadge('bronze')); + expect(laneSum).toBe(DEALS.length); + await waitFor(() => expect(footer()).toHaveTextContent(`${laneSum} records`)); + expect(screen.queryByTestId('data-limit-warning')).not.toBeInTheDocument(); + }); + + it('a lookup-laned board: the footer reads 70 records and no "Showing first 25"', async () => { + mountBoard(countSource(), boardView('account')); + + await waitFor(() => expect(cards()).toHaveLength(25)); + await waitFor(() => expect(screen.getByRole('group', { name: 'Cyan Corp' })).toBeInTheDocument()); + await waitFor(() => expect(footer()).toHaveTextContent('70 records')); + expect(screen.queryByTestId('data-limit-warning')).not.toBeInTheDocument(); + }); + + it('CONTROL: a number-laned board draws the page\'s lanes only, so the footer reads 70 records and keeps "Showing first 25"', async () => { + mountBoard(countSource(), boardView('rank')); + + await waitFor(() => expect(cards()).toHaveLength(25)); + await waitFor(() => expect(laneBadge('1')).toBe('30')); + expect(screen.queryByRole('group', { name: '3' })).toBeNull(); + await waitFor(() => expect(footer()).toHaveTextContent('70 records')); + expect(screen.getByTestId('data-limit-warning')).toHaveTextContent('Showing first 25 records'); + }); + + it('CONTROL: over a source with no grouped door the board reaches no lane past the page, so "Showing first 25" stays', async () => { + mountBoard(countSource(false), boardView('tier')); + + await waitFor(() => expect(cards()).toHaveLength(25)); + await waitFor(() => expect(footer()).toHaveTextContent('70 records')); + expect(screen.getByTestId('data-limit-warning')).toHaveTextContent('Showing first 25 records'); + }); +});