Skip to content

Commit ec087c2

Browse files
fix(kanban): a list view board laned by a text field draws its Uncategorized lane past the first page and loads the rest of a lane's cards (#38500)
repo:objectstack#5 · os-project-manager · session_01FEkQ5pH8MaBBP5T2dVcTHL Fixes #38120 Clause-②: no Metadata-protocol: none ## 维护者速读 - 列表视图里按文本字段分道的看板,空值记录全在第一页之后时,以前没有「未分类」这一道;现在这一道画在最后,带整道计数和「未加载的卡片」提示,各道(含未分类)都能点「加载更多」补齐卡片。按选项分道的看板本来就逐道分页,行为不变。 - 接在「看板按查找字段分道时补画未分类道、逐道加载更多」那两轮之后,替用文本字段分组看板的用户找回这部分记录的入口。 - 只多画一道、多给一个按钮,不改任何数据和配置;数据源不支持分组读、或分组读被拒绝或截断时,照旧只画第一页,可以直接撤回。 - 无。文本字段里某个值的记录全在第一页之后时为它补画一道,已另立 #38506。 ## What changes - `ui/packages/plugin-kanban/src/ObjectKanban.tsx`: the past-page gate (`pastPageLanes`, which drives `keepUncolumned` and the host lane paging `hostLanePagingOn`) now opens over a text lane field (`laneIsText`) as well as over a lookup (`laneTargetObject`). The rest of the gate is unchanged: a host-handed page with a lane read (`hostLaneRead`), flat lanes, lanes from the data, and the null-count rule — a partial (`hasMore`), refused or absent grouped read answers no counts, so nothing is drawn or offered from it. - On a text lane the "Uncategorized" lane's "Load more" reads records whose value is null OR blank (`''`), because the page buckets both into that lane and the lane read counts both under it; a lookup lane keeps `emptyLaneQueryFilter` (null only). - `extraLaneIds` (a lane whose records all sit past the page) is NOT widened: a text value past the page still draws no lane of its own. That is a visible-behaviour choice outside the card's asks; the seat ruled it and filed #38506 for it. - Option lanes: no code change. Measured: under a list view, a board laned by a field with options takes the per-lane paging path (`kanbanLanesPaged` in `ListView.tsx`, objectui#12619), which queries the "Uncategorized" lane on its own (`uncolumnedQueryFilter`: not in the lanes, or null). It already draws that lane with its cards and count when every such record sits past the list's first page. The host-handed path only carries option lanes on a swimlane board, which the flat-lane gate excludes. A pin for this is added (below). - `patch` changeset for `@object-ui/plugin-kanban`. Read first (by risk): `pastPageLanes` / `laneIsText` in `ObjectKanban.tsx`; the `emptyIsBlank` filter branch in `loadMoreHostLane`; the new `objectstack#38120` pins in `listKanbanEveryRecord-12619.test.tsx`. ## Tests All in `ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx` (the shared ListView + ObjectKanban rig the #37516 / #37517 pins live in; a new pin for a component with a shared harness goes into that file, ruling record 6583487846): - text lane (`tier`; deals 60–64 null, 65–69 blank, all past page one of 25): "Uncategorized" drawn last, badge `10`, zero cards, `Cards not loaded: 10`; - its "Load more" loads all 10 (null and blank), filter `["or",["tier","is_null"],["tier","=",""]]`, `$skip: 0`, `$top: 50`, `$count: true`; - a text lane on the page (`gold`, 13 of 30) loads the other 17 from `$skip: 13`, none twice, filter `"tier","=","gold"`; - CONTROL ×3: no grouped door, a refused read, a cut read (`hasMore`) draw no "Uncategorized" and offer no "Load more" (`gold` reads `13+`); - option lane (`stage` select; 6 null-stage and 4 unknown-stage records past the list's first 25): "Uncategorized" drawn with its 10 cards, badge `10`; rig self-check that the list's 25-row window holds none of them. This pins existing behaviour (premise reading); it passes before and after this change, so it carries no ablation. - Replaced: `CONTROL: a board laned by a text field offers no "Load more"`, which pinned exactly the branch this PR changes. Kept: `a board laned by a text field counts each whole lane but draws no lane past the page`. <details><summary>Readings (head 311312f, base origin/main 7e1b222)</summary> - Rig file: `Test Files 1 passed (1)`, `Tests 44 passed (44)`. - `pnpm --filter @object-ui/plugin-kanban type-check` exit 0; `pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-kanban/`: `Test Files 91 passed (91)`, `Tests 623 passed (623)`. - `pnpm --filter @object-ui/app-shell type-check` exit 0 (its `tsconfig.test.json` includes `src/**/*.test.tsx`). - Ablation 1 through `scripts/ablation-replace.mjs`: `(!!laneTargetObject || laneIsText)` to `(!!laneTargetObject /* ABLATED */)`: `Tests 3 failed | 41 passed (44)` — the three text-lane pins (Uncategorized drawn, its load, the `gold` load); every control green. Restored: blob == HEAD, `git diff HEAD` empty. - Ablation 2: `: held.emptyIsBlank` to `: false /* ABLATED */`: `Tests 1 failed | 43 passed (44)` — the Uncategorized load pin (the blank records are not read). Restored: blob == HEAD. - (The first ablation 1 attempt was refused by the tool before running: the replacement text already sat inside the anchor, so its count could not rise; re-run with a distinct replacement.) - Derived local gates (`dispatch-gates.mjs --ran`): 38 derived, 38 run, 0 NOT-MEASURED. 37 exit 0; `pnpm --dir ui exec vitest run scripts/` was SIGKILLed by the shared box's memory limit (exit 1, no test verdict), re-run as `pnpm --dir ui exec vitest run --maxWorkers=2 scripts/`: `Test Files 172 passed | 2 skipped (174)`, exit 0. `pnpm check:new-line-citations`: 0 new citations. </details> ## Acceptance notes - Acceptance "a text-field kanban and an option kanban both show Uncategorized with its count" holds: the text half by this change, the option half by the per-lane paging path already on main (pinned here). - Not drawn by this PR: a text value whose records all sit past page one (in the rig, `bronze`). Filed #38506. - No browser walk: NOT MEASURED in a running app. The rig mounts the real `ListView` over the real `ObjectKanban` with a `ValueDataSource` that evaluates `$filter` / `$skip` / `$top` and a grouped-aggregate door. - No docs page describes the lookup-lane past-page behaviour this extends, so no docs change. ## Verification Two minutes: `pnpm --dir ui exec vitest run packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx -t "text-laned"` — expect 5 passed (the Uncategorized draw, its load, and the three controls), 0 failed. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5pH8MaBBP5T2dVcTHL)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6c5a317 commit ec087c2

3 files changed

Lines changed: 137 additions & 12 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/plugin-kanban': patch
3+
---
4+
5+
fix(kanban): a list view board laned by a text field draws its "Uncategorized" lane when every record with no value sits past the first page, and loads the rest of a lane's cards with "Load more"
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A list view hands its kanban one page of the view's query, and on a board laned by a text field the grouped lane read already counts each whole lane. The trailing "Uncategorized" lane was drawn only by the cards it held, so when every record with no value, or an empty one, sat past the first page those records had no lane on the board; and a lane that counted 30 records while drawing the page's 13 offered no way to load the rest. Both now behave as on a board laned by a lookup: "Uncategorized" is drawn last from the read's count with the "Cards not loaded" line, and a lane that draws fewer cards than it counts offers "Load more", reading its next records under the view's filter, order and search ("Uncategorized" reads the records whose value is empty or blank). A source with no grouped door, or a read that is refused or cut, draws the page's cards as before. A text value whose records all sit past the page still draws no lane of its own. Boards laned by a field's options already page each lane under a list view and are unchanged. Nothing to migrate.

‎ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx‎

Lines changed: 105 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ const ROWS: Row[] = STAGES.flatMap(([stage, , count]) =>
8989
})),
9090
);
9191

92-
function makeDataSource() {
93-
const store = new ValueDataSource<Row>({ items: ROWS });
92+
function makeDataSource(rows: Row[] = ROWS) {
93+
const store = new ValueDataSource<Row>({ items: rows });
9494
return {
9595
find: vi.fn(async (object: string, params: any) => store.find(object, params)),
9696
findOne: vi.fn(),
@@ -165,6 +165,37 @@ describe('a kanban under a list view draws every record of the view in its colum
165165
expect(within(card).queryByText('Probability')).not.toBeInTheDocument();
166166
expect(within(card).queryByText('Close Date')).not.toBeInTheDocument();
167167
});
168+
169+
/**
170+
* objectstack#38120 — a board laned by the options of a select field draws
171+
* its "Uncategorized" lane with its count when every record with no stage, or
172+
* a stage no option names, sits past the list's first page: that lane is a
173+
* query of its own on this board, as each option's lane is.
174+
*/
175+
it('records with no stage or an unknown one, all past the first page, draw "Uncategorized" with their 10 cards and count', async () => {
176+
const strays: Row[] = Array.from({ length: 10 }, (_, i) => ({
177+
id: `stray-${i}`,
178+
name: `stray deal ${i}`,
179+
account: `Account stray ${i}`,
180+
stage: i < 6 ? null : 'archived',
181+
amount: 1,
182+
probability: 40,
183+
close_date: '2026-11-01',
184+
}));
185+
const ds = makeDataSource([...ROWS, ...strays]);
186+
mountBoard(ds);
187+
188+
await waitFor(() => expect(cards()).toHaveLength(55));
189+
expect(within(lane('Uncategorized')).getAllByRole('listitem')).toHaveLength(10);
190+
expect((within(lane('Uncategorized')).getByRole('heading').parentElement!.querySelector('span')!.textContent ?? '').trim()).toBe('10');
191+
// RIG SELF-CHECK: the list's own window, its first 25 rows, holds none of them.
192+
const at = ds.find.mock.calls.findIndex((call: any[]) => call[1]?.$top === 25);
193+
expect(at).toBeGreaterThanOrEqual(0);
194+
const answer = (await ds.find.mock.results[at].value) as any;
195+
const page: Row[] = Array.isArray(answer) ? answer : answer.data ?? answer.records ?? [];
196+
expect(page).toHaveLength(25);
197+
expect(page.some((row) => String(row.id).startsWith('stray'))).toBe(false);
198+
});
168199
});
169200

170201
/**
@@ -847,12 +878,80 @@ describe('a lookup-laned board under a list view counts and totals each whole la
847878
expect(laneReads(ds)).toHaveLength(0);
848879
});
849880

850-
it('CONTROL: a board laned by a text field offers no "Load more"', async () => {
851-
mountBoard(dealSource(), { ...BOARD_VIEW, kanban: { ...BOARD_VIEW.kanban, groupByField: 'tier' } });
852-
881+
/**
882+
* objectstack#38120 — a board laned by a text field draws its "Uncategorized"
883+
* lane from the lane read's count, and offers "Load more" on a lane that
884+
* draws fewer cards than it counts, as a lookup-laned board does. Deals
885+
* 60–64 have no tier and 65–69 an empty one, all past the first page.
886+
*/
887+
const TIER_VIEW = { ...BOARD_VIEW, kanban: { ...BOARD_VIEW.kanban, groupByField: 'tier' } };
888+
const NO_TIER_PAST_PAGE: Row[] = DEALS.map((d, i) => (i >= 65 ? { ...d, tier: '' } : i >= 60 ? { ...d, tier: null } : d));
889+
async function tierPageDrawn() {
853890
await waitFor(() => expect(cards()).toHaveLength(25));
854-
await waitFor(() => expect(laneBadge('gold')).toBe('30'));
891+
expect(within(lane('gold')).getAllByRole('listitem')).toHaveLength(13);
892+
expect(within(lane('silver')).getAllByRole('listitem')).toHaveLength(12);
893+
}
894+
895+
it('a text-laned board draws "Uncategorized" last, counting its 10 records with no tier, all past the page', async () => {
896+
mountBoard(dealSource(true, NO_TIER_PAST_PAGE), TIER_VIEW);
897+
898+
await tierPageDrawn();
899+
await waitFor(() => expect(screen.getByRole('group', { name: 'Uncategorized' })).toBeInTheDocument());
900+
expect(laneBadge('Uncategorized')).toBe('10');
901+
expect(within(lane('Uncategorized')).queryAllByRole('listitem')).toHaveLength(0);
902+
expect(within(lane('Uncategorized')).getByText('Cards not loaded: 10')).toBeInTheDocument();
903+
expect(laneNames().slice(-3)).toEqual(['gold', 'silver', 'Uncategorized']);
904+
});
905+
906+
it('the text-laned "Uncategorized" lane loads its 10 records, those with no tier and those with an empty one', async () => {
907+
const ds = dealSource(true, NO_TIER_PAST_PAGE);
908+
mountBoard(ds, TIER_VIEW);
909+
910+
await tierPageDrawn();
911+
await waitFor(() => expect(loadMore('Uncategorized')).not.toBeNull());
912+
fireEvent.click(loadMore('Uncategorized')!);
913+
914+
await waitFor(() => expect(within(lane('Uncategorized')).getAllByRole('listitem')).toHaveLength(10));
915+
expect(loadMore('Uncategorized')).toBeNull();
916+
expect(laneBadge('Uncategorized')).toBe('10');
917+
const read = laneReads(ds)[0];
918+
expect(read).toMatchObject({ $skip: 0, $top: 50, $count: true });
919+
expect(JSON.stringify(read.$filter)).toContain('["or",["tier","is_null"],["tier","=",""]]');
920+
});
921+
922+
it('a text lane on the page with 13 of its 30 cards loads the other 17 from its 14th record', async () => {
923+
const ds = dealSource();
924+
mountBoard(ds, TIER_VIEW);
925+
926+
await tierPageDrawn();
927+
await waitFor(() => expect(loadMore('gold')).not.toBeNull());
928+
expect(loadMore('silver')).not.toBeNull();
929+
fireEvent.click(loadMore('gold')!);
930+
931+
await waitFor(() => expect(within(lane('gold')).getAllByRole('listitem')).toHaveLength(30));
932+
expect(new Set(cardNames('gold')).size).toBe(30);
933+
expect(loadMore('gold')).toBeNull();
934+
expect(laneBadge('gold')).toBe('30');
935+
const reads = laneReads(ds);
936+
expect(reads).toHaveLength(1);
937+
expect(reads[0]).toMatchObject({ $skip: 13, $top: 50 });
938+
expect(JSON.stringify(reads[0].$filter)).toContain('"tier","=","gold"');
939+
});
940+
941+
it.each([
942+
['has no grouped door', false],
943+
['refuses the read', 'refuse'],
944+
['cuts the read (hasMore)', 'cut'],
945+
] as const)('CONTROL: when the source %s, a text-laned board draws no "Uncategorized" lane and offers no "Load more"', async (_, door) => {
946+
const ds = dealSource(door, NO_TIER_PAST_PAGE);
947+
mountBoard(ds, TIER_VIEW);
948+
949+
await tierPageDrawn();
950+
if (door !== false) await waitFor(() => expect(ds.queryGroupHeaders).toHaveBeenCalledTimes(1));
951+
await waitFor(() => expect(laneBadge('gold')).toBe('13+'));
952+
expect(screen.queryByRole('group', { name: 'Uncategorized' })).toBeNull();
855953
expect(screen.queryAllByRole('button', { name: 'Load more' })).toHaveLength(0);
954+
expect(laneReads(ds)).toHaveLength(0);
856955
});
857956

858957
it('a board laned by a text field counts each whole lane but draws no lane past the page', async () => {

‎ui/packages/plugin-kanban/src/ObjectKanban.tsx‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
resolveNameField,
5151
resolveAffordance,
5252
isDeadlineSettled,
53+
mergeFilterNodes,
5354
referencedRecordTitle,
5455
stateMachineNextValues,
5556
type SchemaLike,
@@ -1980,8 +1981,9 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
19801981
* record (one read of those records on the lane field's target object) and
19811982
* by its key until then. The empty group is not one of them: it is the
19821983
* trailing "Uncategorized" lane, drawn by the cards it holds and, over the
1983-
* same lane fields, by the read's count of it when none of those cards is
1984-
* on the page (`keepUncolumned` below, objectstack#37516).
1984+
* same lane fields and text ones, by the read's count of it when none of
1985+
* those cards is on the page (`keepUncolumned` below, objectstack#37516,
1986+
* objectstack#38120).
19851987
*
19861988
* Only over a lane field that names the object it references
19871989
* (`laneTargetObject`): a reference's group key is its foreign key, the
@@ -2005,8 +2007,16 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
20052007
* draws the lane, so the board draws it from that count, under the gate the
20062008
* lanes past the page take. A partial or refused read answers no counts
20072009
* (`hostLaneCounts` null), and no lane is drawn from it.
2010+
*
2011+
* objectstack#38120 — the same over a text lane field (`laneIsText`), with
2012+
* "Load more" below: a text value is its own lane key, so `field = key`
2013+
* reads a lane's records as a find row spells them. A lane whose records all
2014+
* sit past the page is still not drawn there (`extraLaneIds`). A board laned
2015+
* by a field's options pages each lane itself under a list view
2016+
* (`lanePaging`), its "Uncategorized" lane included.
20082017
*/
2009-
const pastPageLanes = hostLaneRead && flatLanes && lanesFromData && !!laneTargetObject;
2018+
const laneIsText = laneFieldDef?.type === 'text';
2019+
const pastPageLanes = hostLaneRead && flatLanes && lanesFromData && (!!laneTargetObject || laneIsText);
20102020
const keepUncolumned = pastPageLanes && (hostLaneCounts?.[KANBAN_UNCOLUMNED_ID] ?? 0) > 0;
20112021
/**
20122022
* objectstack#37517 — "Load more" on a lane of the board handed one page:
@@ -2044,6 +2054,7 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
20442054
pages: Record<string, KanbanLanePage> | null;
20452055
objectName: string;
20462056
groupBy: string;
2057+
emptyIsBlank: boolean;
20472058
filter: unknown;
20482059
params: Record<string, unknown>;
20492060
} | null>(null);
@@ -2061,6 +2072,7 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
20612072
pages: hostLanePages,
20622073
objectName: schema.objectName,
20632074
groupBy: schema.groupBy,
2075+
emptyIsBlank: laneIsText,
20642076
filter: queryFilter,
20652077
params: {
20662078
$orderby: convertSortToQueryParams(schema.sort),
@@ -2087,9 +2099,13 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
20872099
return loading;
20882100
};
20892101
mark((prev) => ({ ...prev, loading: { ...prev.loading, [laneId]: true } }));
2090-
const filter = laneId === KANBAN_UNCOLUMNED_ID
2091-
? emptyLaneQueryFilter(held.filter, held.groupBy)
2092-
: laneQueryFilter(held.filter, held.groupBy, laneId);
2102+
// A text lane's empty value is `''` as well as none: both draw the
2103+
// trailing lane (`laneKeyOf`) and the lane read counts both under it.
2104+
const filter = laneId !== KANBAN_UNCOLUMNED_ID
2105+
? laneQueryFilter(held.filter, held.groupBy, laneId)
2106+
: held.emptyIsBlank
2107+
? mergeFilterNodes(held.filter, ['or', [held.groupBy, 'is_null'], [held.groupBy, '=', '']])
2108+
: emptyLaneQueryFilter(held.filter, held.groupBy);
20932109
dataSource
20942110
.find(held.objectName, { ...held.params, $filter: filter, $skip: page.loaded, $top: KANBAN_LANE_PAGE_SIZE } as any)
20952111
.then((result) => {

0 commit comments

Comments
 (0)