Skip to content

Commit 4ed453d

Browse files
fix(ui): queryGroupHeaders hands on the server's hasMore, and a cut lane read draws no lane figure (#37277)
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW Fixes #36870 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在限制了默认分页大小的部署上,看板泳道底部的合计、平均、最小、最大值,在服务器分组答案被截断时不再显示错误数字(如「合计 0」或少算),而是不显示;答案完整时照常显示。 - 为什么做:补上上一张卡评审记录(7124305685)里点名的两个残余情形(折叠泳道的部分合计、单次查询看板的「合计 0」)。这一族还有后续:列表里看板的单页合计和分组表格、币种读取的截断,另有卡承接。 - 出错会怎样:最坏是本该显示的泳道统计不显示,不会显示错误数字;分组表格与币种读取不受影响,可直接撤回。 - 要你做什么:无 ## What changes - `@object-ui/types`: new exported type `ListViewGroupHeaderAnswer` = `ListViewGroupHeaderRow[] & { hasMore?: boolean }`; `DataSource.queryGroupHeaders` now answers it. `hasMore: true` means the answer is partial (the door cut the groups). A source returning a plain array still satisfies the member, and a caller reading the answer as an array is unchanged. - `@object-ui/data-objectstack`: `queryGroupHeaders` sets `hasMore = true` on the returned rows array when `POST /data/:object/query` answers `hasMore: true` (the grouped branch in `protocol-data-crud.ts` slices to the default page size and answers it). A whole answer carries no `hasMore`. - `@object-ui/plugin-kanban`: new `readLaneStatistic(answer, reading)` answers `null` (no figure for ANY lane) for a partial answer, else `readLaneFigures`. `ObjectKanban` reads the lane read through it. Covers both residual cases of scope note 7124305685: the folded "Uncategorized" lane's partial figure, and "Sum 0" on a board of one query whose lane group was cut. The `laneFigureOf` comment that said the flag is not handed on is corrected. - The grouped grid (`useServerGrouping`), the whole-set footer (`useWholeSetSummary`) and `usedCurrencyCodes` are untouched and read the same array. Clause-② measurement: after `@object-ui/types` build, `dist/index.d.ts` carries 1 hit and `dist/data.d.ts` 3 hits of `ListViewGroupHeaderAnswer`; `git grep -c ListViewGroupHeaderAnswer 9171bed -- ui/` answers 0 hits (exit 1). `dist/data.d.ts:956` now types the member's return as a Promise of `ListViewGroupHeaderAnswer`. One new exported name plus an optional field on the return: widening. A tsc probe (`--strict`) shows a plain `Row[]` is assignable to the new answer type, so no implementer is narrowed. The claim carried `Clause-②: no`; this PR declares what was measured. ## Tests <details><summary>Targeted pins (new)</summary> - `ui/packages/data-objectstack/src/queryGroupHeaders-7189.test.ts`, new describe: a door capped at a default page size of 2 over 5 groups gives `rows.hasMore === true`, rows still an array of the first 2; CONTROL page size 100: `hasMore` undefined, all 5 rows. - `ui/packages/plugin-kanban/src/ObjectKanban.laneStatistic-36370.test.tsx`, new top-level describe `a cut lane read draws no lane figure (objectstack#36870)` (the shared harness file): a lane door that cuts to `pageSize` rows and sets `hasMore`. - paged board, page size 3 (open, won, empty group of 4 groups): the answer's `hasMore` is true and no `[data-kanban-lane-statistic]` is drawn anywhere, Uncategorized included; - board of one query (`limit: 10`), page size 1: no "Sum 0" on Won, no figure anywhere; - CONTROL page size 4 (whole): Open 2415, Won 10, Lost 0, Uncategorized 4. </details> <details><summary>Ablations (scripts/ablation-replace.mjs, mutation proven on disk, restored to HEAD)</summary> - Deleted the partial check line in `readLaneStatistic`: anchor 1 -> 0, blob b0d3771 -> 74ec141db; the two 36870 kanban pins went red (a lane statistic element was drawn where null was expected), CONTROL stayed green (2 failed, 1 passed). Restored: blob == HEAD, `git diff HEAD` empty. - Deleted the `answer.hasMore = true` line in the adapter: anchor 1 -> 0; `sets hasMore on an answer capped by a small default page size` red, 5 others green. Restored: blob == HEAD, `git diff HEAD` empty. - Both test files import the source directly (relative `./KanbanLaneStatistic`, `./index`), so no `dist/` is involved. </details> <details><summary>Package suites and type-check (head 3696758)</summary> - `vitest run packages/plugin-kanban/ packages/data-objectstack/ packages/types/` under the verify lock: Test Files 604 passed (604), Tests 12516 passed (12516), VERDICT command-exit 0. - Consumer tests naming `queryGroupHeaders` (40 files across plugin-grid, components, plugin-list, console): Test Files 40 passed (40), Tests 569 passed (569). - `pnpm --filter @object-ui/types --filter @object-ui/data-objectstack --filter @object-ui/plugin-kanban run type-check`: exit 0. `... --filter @object-ui/plugin-grid --filter @object-ui/components run type-check`: exit 0. Declared narrowing: these two type-check runs ran outside the verify lock after three 540 s queue timeouts behind a 37-minute dogfood holder; tsc --noEmit writes nothing. </details> <details><summary>Derived gates</summary> `dispatch-gates --commands`: 40 commands; all 40 run with exit codes recorded; `--ran` reconciliation: 40 derived, 40 run, 0 NOT-MEASURED, 0 UNRUN. `pnpm check:type-check-debt` first answered exit 3 (lock queue timeout, never acquired), re-run exit 0. `pnpm --dir ui exec vitest run scripts/`: Test Files 172 passed, 2 skipped. Type-check lanes, the wide-population families and the full farm are CI's. </details> ## Acceptance notes - The grouped grid (`useServerGrouping`) and `usedCurrencyCodes` do not read the new flag: if their grouped read is cut, a grid could list fewer groups than exist and the currency read could miss a code. Read from code only, not run, so no reach is measured here; carrier: #37278 (Blocked-by #36870), filed at the seat's direction. Both callers keep working exactly as before, as the card asks. - `laneFigureOf`'s `holdsRecords` guard stays: over a whole answer it still catches a board count and an answer that disagree (a write between the two reads). ## Verification Read first: 1. `ui/packages/plugin-kanban/src/KanbanLaneStatistic.ts`, `readLaneStatistic`: the one line that turns a partial answer into no figures. 2. `ui/packages/data-objectstack/src/index.ts`, `queryGroupHeaders`: where `hasMore` is set on the rows array. 3. `ui/packages/types/src/data.ts`, `ListViewGroupHeaderAnswer`: the published shape. Two-minute check: `cd ui && npx vitest run --root . packages/plugin-kanban/src/ObjectKanban.laneStatistic-36370.test.tsx -t 36870` should show 3 passed. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6cfa758 commit 4ed453d

8 files changed

Lines changed: 227 additions & 11 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/types': patch
3+
'@object-ui/data-objectstack': patch
4+
'@object-ui/plugin-kanban': patch
5+
---
6+
7+
fix(ui): a grouped read the server cut says so, and a kanban board draws no lane figure over it
8+
9+
Clause-②: yes (widening) — `@object-ui/types` exports the new type `ListViewGroupHeaderAnswer` (the header rows array plus an optional `hasMore`), and `DataSource.queryGroupHeaders` answers it in place of `ListViewGroupHeaderRow[]`; a source that returns a plain array still satisfies the member, and a caller that reads the answer as an array reads it unchanged; nothing removed or renamed
10+
Metadata-protocol: none
11+
12+
On a deployment that sets a default page size (`OS_DATA_DEFAULT_PAGE_SIZE` or `OS_DATA_MAX_PAGE_SIZE`), `POST /data/:object/query` cuts a grouped read with no `limit` to that page size and answers `hasMore: true`. `ObjectStackAdapter.queryGroupHeaders` used to return the header rows alone, so a caller could not tell a cut answer from a whole one. It now sets `hasMore: true` on the answer it returns when the server says groups were dropped; a whole answer carries no `hasMore`.
13+
14+
The kanban lane statistic (`kanban.summary` of type `sum`, `avg`, `min` or `max`) reads that flag: over a cut answer it draws no figure for any lane. Before, the trailing "Uncategorized" lane could total only the groups the answer carried, and on a board of one query a lane whose group was dropped could draw "Sum 0". A whole answer draws every lane's figure as before.
15+
16+
The grouped grid and the currency-code read keep reading the answer as the same array.

‎ui/packages/data-objectstack/src/index.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { ObjectStackClient, type QueryOptions as ObjectStackQueryOptions } from '@objectstack/client';
1010
import type { DroppedFieldsEvent, EngineAggregateOptions } from '@objectstack/spec/data';
11-
import type { Dataset, ListViewGroupHeaderRow } from '@objectstack/spec/ui';
11+
import type { Dataset } from '@objectstack/spec/ui';
1212
// objectui#11013 — a VALUE import: the keys `listViews` carries off a stored
1313
// ViewItem record are the spec's own record of the console's round-trip keys,
1414
// read off the pin rather than hand-listed (see `VIEW_ITEM_ROUND_TRIP_KEYS`).
@@ -79,6 +79,7 @@ import type {
7979
ImportJobSummaryInfo,
8080
ImportJobUndoResult,
8181
ListImportJobsOptions,
82+
ListViewGroupHeaderAnswer,
8283
} from '@object-ui/types';
8384
import { errorCodeIs, errorCodeIsAnyOf } from '@object-ui/types';
8485
import {
@@ -7696,11 +7697,17 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
76967697
* that promises the query's own numbers, which is the defect this member
76977698
* exists to end. A failure is thrown to the caller, and a body without a
76987699
* `records` array is refused rather than read as "no groups".
7700+
*
7701+
* The door answers `hasMore` beside `records`: a grouped read with no
7702+
* `limit` is cut to the deployment's default page size, and `hasMore: true`
7703+
* says groups were dropped. It is handed on as the answer's `hasMore`
7704+
* (objectstack#36870), so a caller that folds the groups into a total can
7705+
* tell a cut answer from a whole one.
76997706
*/
77007707
async queryGroupHeaders(
77017708
resource: string,
77027709
query: EngineAggregateOptions,
7703-
): Promise<ListViewGroupHeaderRow[]> {
7710+
): Promise<ListViewGroupHeaderAnswer> {
77047711
await this.connect();
77057712
const result: unknown = await this.client.data.query(resource, query as any);
77067713
const records = (result as { records?: unknown } | null)?.records;
@@ -7711,7 +7718,9 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
77117718
+ 'sent verbatim; nothing was approximated from a page of rows.',
77127719
);
77137720
}
7714-
return records as ListViewGroupHeaderRow[];
7721+
const answer = records as ListViewGroupHeaderAnswer;
7722+
if ((result as { hasMore?: unknown }).hasMore === true) answer.hasMore = true;
7723+
return answer;
77157724
}
77167725

77177726
/**

‎ui/packages/data-objectstack/src/queryGroupHeaders-7189.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,39 @@ describe('ObjectStackAdapter.queryGroupHeaders (objectui#7189)', () => {
117117
expect(posted[0].url).toMatch(/\/data\/work_item\/query$/);
118118
});
119119
});
120+
121+
/**
122+
* objectstack#36870 — a grouped read the door CUT says so. With no `limit`,
123+
* `POST /data/:object/query` slices the grouped answer to the deployment's
124+
* default page size (`OS_DATA_DEFAULT_PAGE_SIZE`) and answers `hasMore: true`;
125+
* the adapter hands that on as the answer's `hasMore`, beside rows that are
126+
* still an array, so a caller that only lists the groups reads it unchanged.
127+
*/
128+
describe('ObjectStackAdapter.queryGroupHeaders hands on a cut answer (objectstack#36870)', () => {
129+
/** The door's grouped branch under a default page size: slice, then say whether groups were dropped. */
130+
function cappedAt(defaultPageSize: number) {
131+
const records = HEADER_ROWS.slice(0, defaultPageSize);
132+
return makeAdapter({
133+
status: 200,
134+
body: {
135+
success: true,
136+
data: { object: 'work_item', records, total: HEADER_ROWS.length, hasMore: records.length < HEADER_ROWS.length },
137+
},
138+
});
139+
}
140+
141+
it('sets `hasMore` on an answer capped by a small default page size', async () => {
142+
const { adapter } = cappedAt(2);
143+
const rows = await adapter.queryGroupHeaders('work_item', compileListViewGroupQuery(VIEW));
144+
expect(rows.hasMore).toBe(true);
145+
expect(Array.isArray(rows)).toBe(true);
146+
expect([...rows]).toEqual(HEADER_ROWS.slice(0, 2));
147+
});
148+
149+
it('CONTROL: a whole answer carries no `hasMore`', async () => {
150+
const { adapter } = cappedAt(100);
151+
const rows = await adapter.queryGroupHeaders('work_item', compileListViewGroupQuery(VIEW));
152+
expect(rows.hasMore).toBeUndefined();
153+
expect([...rows]).toEqual(HEADER_ROWS);
154+
});
155+
});

‎ui/packages/plugin-kanban/src/KanbanLaneStatistic.ts‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ import { laneKeyOf } from './kanbanReferenceLanes';
5151
* lane query does; a board of one query matches it without case, as it buckets
5252
* its cards (`index.tsx`). A board whose lanes come from the data draws one
5353
* lane per key, so only the empty key is "Uncategorized".
54+
*
55+
* ## A partial answer
56+
*
57+
* The door cuts a grouped read to the deployment's default page size and says
58+
* so (`hasMore`). A cut answer draws no figure for any lane
59+
* ({@link readLaneStatistic}, objectstack#36870).
5460
*/
5561

5662
/** The lane statistics answered by the server lane read. */
@@ -228,17 +234,37 @@ export function readLaneFigures(rows: unknown, reading: LaneFigureReading): Reco
228234
return figures;
229235
}
230236

237+
/**
238+
* Every lane's figure from the lane read's ANSWER, or `null` — no figure for
239+
* any lane — when the answer is partial (objectstack#36870).
240+
*
241+
* The grouped read can be cut: under a deployment's default page size the
242+
* door slices the group rows and answers `hasMore`, which
243+
* `DataSource.queryGroupHeaders` hands on as the answer's `hasMore`. A cut
244+
* answer is not every lane's groups: a lane that folds several groups (the
245+
* trailing "Uncategorized" lane) would total only the groups answered, and a
246+
* lane whose group was dropped would read as empty — `0` for a sum. Neither is
247+
* a figure the board can draw, and the answer does not say which lanes it cut,
248+
* so no lane draws one.
249+
*/
250+
export function readLaneStatistic(
251+
answer: unknown,
252+
reading: LaneFigureReading,
253+
): Record<string, LaneFigure> | null {
254+
if (Array.isArray(answer) && (answer as { hasMore?: unknown }).hasMore === true) return null;
255+
return readLaneFigures(answer, reading);
256+
}
257+
231258
/**
232259
* One lane's figure: what the read answered for it, else the figure of a lane
233260
* that holds no record — `0` for a sum, none for an average, a minimum or a
234261
* maximum.
235262
*
236263
* A lane the board knows holds records (`holdsRecords`: its count is above
237-
* zero) that no group answered for draws NO figure. The grouped read can be
238-
* cut: under a deployment's default page size the door slices the group rows
239-
* and answers `hasMore`, which `queryGroupHeaders` does not hand on. Such a
240-
* lane's group was dropped, not empty, and a `0` there would be a wrong figure
241-
* in place of a missing one.
264+
* zero) that no group answered for draws NO figure: the board's count and the
265+
* whole answer disagree (a write landed between the two reads), and a `0`
266+
* there would be a wrong figure in place of a missing one. A PARTIAL answer
267+
* never reaches here — {@link readLaneStatistic} answers no figures for it.
242268
*/
243269
export function laneFigureOf(
244270
figures: Readonly<Record<string, LaneFigure>>,

‎ui/packages/plugin-kanban/src/ObjectKanban.laneStatistic-36370.test.tsx‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,111 @@ describe('a lane statistic covers every record of the lane (objectstack#36520)',
408408
});
409409
});
410410

411+
/**
412+
* objectstack#36870 — a lane read the door CUT draws no figure for any lane.
413+
*
414+
* Under a deployment's default page size the door slices the grouped answer
415+
* and says so (`hasMore`), which `queryGroupHeaders` hands on as the answer's
416+
* `hasMore`. `cappedAt` answers the lane read the way that door does: every
417+
* group `groupHeadersOver` finds, cut to `pageSize` rows. The groups of
418+
* `ROWS_70` are open, won, the empty group and `archived`, in that order.
419+
*/
420+
describe('a cut lane read draws no lane figure (objectstack#36870)', () => {
421+
const OBJECT = 'deal';
422+
const DEF = {
423+
name: OBJECT,
424+
fields: {
425+
name: { type: 'text', label: 'Name' },
426+
amount: { type: 'number', label: 'Amount' },
427+
stage: {
428+
type: 'select',
429+
label: 'Stage',
430+
options: [
431+
{ value: 'open', label: 'Open' },
432+
{ value: 'won', label: 'Won' },
433+
{ value: 'lost', label: 'Lost' },
434+
],
435+
},
436+
},
437+
};
438+
const deals = (stage: string | null, n: number): Row[] =>
439+
Array.from({ length: n }, (_, i) => ({
440+
id: `${stage ?? 'none'}-${String(i).padStart(3, '0')}`,
441+
name: `${stage ?? 'none'} ${String(i).padStart(3, '0')}`,
442+
stage,
443+
amount: i,
444+
}));
445+
const ROWS_70 = [...deals('open', 70), ...deals('won', 5), ...deals(null, 2), ...deals('archived', 3)];
446+
447+
function cappedAt(rows: Row[], pageSize: number) {
448+
const whole = groupHeadersOver(rows, OBJECT);
449+
return vi.fn(async (object: string, query: any) => {
450+
const groups = (await whole(object, query)) as Row[];
451+
const answer = groups.slice(0, pageSize) as Row[] & { hasMore?: boolean };
452+
if (answer.length < groups.length) answer.hasMore = true;
453+
return answer;
454+
});
455+
}
456+
457+
function mount(pageSize: number, lanePaging: Record<string, unknown> | undefined, schema: Record<string, unknown> = {}) {
458+
const store = new ValueDataSource<Row>({ items: ROWS_70 });
459+
const source = {
460+
find: vi.fn(async (object: string, params: any) => store.find(object, params)),
461+
findOne: vi.fn(),
462+
create: vi.fn(),
463+
update: vi.fn(),
464+
delete: vi.fn(),
465+
getObjectSchema: vi.fn(async () => DEF),
466+
queryGroupHeaders: cappedAt(ROWS_70, pageSize),
467+
} as any;
468+
render(
469+
<SchemaRendererProvider dataSource={source}>
470+
<ObjectKanban
471+
schema={{ type: 'object-kanban', objectName: OBJECT, groupBy: 'stage', cardFields: ['amount'], summary: { type: 'sum', field: 'amount' }, ...schema } as any}
472+
dataSource={source}
473+
{...(lanePaging ? { lanePaging } : {})}
474+
/>
475+
</SchemaRendererProvider>,
476+
);
477+
return source;
478+
}
479+
480+
const lane = (title: string) => screen.getByRole('group', { name: title });
481+
const foot = (title: string) => lane(title).querySelector<HTMLElement>('[data-kanban-lane-statistic]');
482+
const figure = (title: string) => (foot(title)?.lastElementChild?.textContent ?? '').replace(/,/g, '');
483+
484+
it('draws no figure on any lane when the read is cut, the folded lane included', async () => {
485+
// Three of four groups: open, won and the empty group. The trailing lane
486+
// would total the empty group alone (1) in place of 4.
487+
const source = mount(3, {});
488+
await waitFor(() => expect(source.queryGroupHeaders).toHaveBeenCalledTimes(1));
489+
await waitFor(() => expect(within(lane('Open')).queryAllByRole('listitem')).toHaveLength(KANBAN_LANE_PAGE_SIZE));
490+
await waitFor(() => expect(within(lane('Uncategorized')).queryAllByRole('listitem')).toHaveLength(5));
491+
expect((await source.queryGroupHeaders.mock.results[0].value).hasMore).toBe(true);
492+
expect(document.querySelector('[data-kanban-lane-statistic]')).toBeNull();
493+
});
494+
495+
it('draws no "Sum 0" on a board of one query whose lane group the read cut', async () => {
496+
// One group: open. The board loads 10 open cards, so Won counts none of
497+
// its five records and would read the dropped group as an empty lane.
498+
const source = mount(1, undefined, { limit: 10 });
499+
await waitFor(() => expect(source.queryGroupHeaders).toHaveBeenCalledTimes(1));
500+
await waitFor(() => expect(within(lane('Open')).queryAllByRole('listitem')).toHaveLength(10));
501+
expect((await source.queryGroupHeaders.mock.results[0].value).hasMore).toBe(true);
502+
expect(document.querySelector('[data-kanban-lane-statistic]')).toBeNull();
503+
});
504+
505+
it('CONTROL: a whole answer under the same door draws every lane\'s figure', async () => {
506+
const source = mount(4, {});
507+
await waitFor(() => expect(foot('Open')).not.toBeNull());
508+
expect((await source.queryGroupHeaders.mock.results[0].value).hasMore).toBeUndefined();
509+
expect(figure('Open')).toBe('2415');
510+
expect(figure('Won')).toBe('10');
511+
expect(figure('Lost')).toBe('0');
512+
expect(figure('Uncategorized')).toBe('4');
513+
});
514+
});
515+
411516
describe('readLaneFigures (objectstack#36520)', () => {
412517
const base = { laneField: 'stage', field: 'amount', uncolumnedId: '__uncolumned__' } as const;
413518
it('keys a reference lane by its foreign key and folds what is no lane into the trailing lane', () => {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ import { lanesFromRecords, laneValueOf } from './kanbanReferenceLanes';
8686
import {
8787
compileLaneStatisticQuery,
8888
isLaneAggregate,
89-
readLaneFigures,
89+
readLaneStatistic,
9090
type LaneFigure,
9191
} from './KanbanLaneStatistic';
9292

@@ -1726,8 +1726,10 @@ export const ObjectKanban: React.FC<ObjectKanbanComponentProps> = ({
17261726
// Nothing is cleared before the answer lands: re-asking the question in
17271727
// hand (a refresh, a write) keeps its figures on screen until the new ones.
17281728
Promise.resolve().then(() => dataSource.queryGroupHeaders!(objectName, query)).then(
1729+
// A partial answer (the door cut the groups: `hasMore`) reads as no
1730+
// figure for any lane, as a refusal does (objectstack#36870).
17291731
(rows) => {
1730-
if (!cancelled) setLaneStatistics({ question: laneStatisticQuestion + statisticLanesKey, figures: readLaneFigures(rows, reading) });
1732+
if (!cancelled) setLaneStatistics({ question: laneStatisticQuestion + statisticLanesKey, figures: readLaneStatistic(rows, reading) });
17311733
},
17321734
() => {
17331735
// A refusal (a field the reader may not read: `403`) draws no figure.

‎ui/packages/types/src/data.ts‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,11 +1001,17 @@ export interface DataSource<T = any> {
10011001
* `groupBy`) and may degrade to a client-side reduction; this one takes the
10021002
* compiled header query verbatim and never degrades.
10031003
*
1004+
* A source that answers only PART of the groups (the platform cuts a
1005+
* grouped read to a deployment's default page size) says so with
1006+
* `hasMore: true` on the answer — see {@link ListViewGroupHeaderAnswer}. A
1007+
* caller that reads the answer as the WHOLE set of groups (a total folded
1008+
* over them, an absent group read as an empty one) must check it first.
1009+
*
10041010
* @param resource - Object name
10051011
* @param query - The compiled header query (`EngineAggregateOptions`)
10061012
* @returns One header row per group, as the platform answers it
10071013
*/
1008-
queryGroupHeaders?(resource: string, query: EngineAggregateOptions): Promise<ListViewGroupHeaderRow[]>;
1014+
queryGroupHeaders?(resource: string, query: EngineAggregateOptions): Promise<ListViewGroupHeaderAnswer>;
10091015

10101016
/**
10111017
* Subscribe to mutation events.
@@ -1522,6 +1528,21 @@ export interface AggregateParams {
15221528
filter?: any;
15231529
}
15241530

1531+
/**
1532+
* The answer of `DataSource.queryGroupHeaders`: one header row per group, as
1533+
* an array, so a caller that only lists the groups reads it as one.
1534+
*
1535+
* `hasMore: true` says the answer is PARTIAL — the source answered some of
1536+
* the groups and more exist (the platform's `POST /data/:object/query` cuts a
1537+
* grouped read with no `limit` to the deployment's default page size and
1538+
* answers `hasMore`). A group absent from a partial answer was dropped, not
1539+
* empty. Absent or `false`: the answer is every group the query has.
1540+
*/
1541+
export type ListViewGroupHeaderAnswer = ListViewGroupHeaderRow[] & {
1542+
/** `true` when more groups exist than the answer carries. */
1543+
hasMore?: boolean;
1544+
};
1545+
15251546
/**
15261547
* Result of a server-side aggregation.
15271548
* Each entry represents one group with the aggregated value.

‎ui/packages/types/src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ export type {
475475
FileUploadResult,
476476
AggregateParams,
477477
AggregateResult,
478+
ListViewGroupHeaderAnswer,
478479
DataSourceMutationEvent,
479480
BulkWriteRowError,
480481
BulkWriteResult,

0 commit comments

Comments
 (0)