Skip to content

Commit 4034a6d

Browse files
fix(plugin-dashboard): a record opened from a drill counts and steps through the whole drill (#36658)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Jx4cUmYNpTragccfoD4M4E)_ Fixes #36554 Clause-②: yes (widening) — one additive member, `ListViewProps.onFindParamsChange` (`@object-ui/plugin-list`); nothing is removed or renamed Metadata-protocol: none The remainder of the drill-dialog card #36256 (after PR #36461): the one open defect against its item 6, and the 「上季度」 acceptance line re-read on data that has last-quarter values. Card #36256 stays open on this merge; whether it ends once this lands is the seat's call (the re-check below reads as passed). ## 维护者速读 - 从仪表盘或报表的明细弹窗点进一条记录后,记录页顶上的「第几条,共几条」和上下翻,现在按明细的全部记录算,不再只算弹窗里已经画出来的那一页。 - 属于「仪表盘和报表的使用体验」专题,补完「点记录进整页并能在明细里上下翻」这一点。 - 出错时最多回到以前的样子(只在已画出的行里翻);只多了一次只读取编号的查询,随时可以撤回。 - 无 ## What changes - **The count reaches the drill.** The `list-view` page block handed the list its own tab-badge reporter as `onTotalChange` after spreading the host's props, so a host's `onTotalChange` (the drill's) was never called. The block now calls both: the host's and the tab badge's. - **The list reports the query behind its rows.** `ListView` gains a host prop, `onFindParamsChange(findParams)`, called with the params of the read that drew the rows `onRowsChange` reports, each time that query settles with a different answer, keyed on its content. It answers where `onRowsChange` answers with rows (a paged grid that draws the rows it fetched) and answers `null` for any other kind. - **The drill hands the record page the whole drill.** `DrillRecordList` keeps that query and, when a record name is clicked and the count exceeds the rows drawn (or the rows drawn are a later page), re-issues it for ids alone (`drillRecordOrigin`, new `drillRecordSteps.ts`): the same filter, sort and search, `$select: ['id']`, window by window at the list's own window or 100, whichever is wider, up to 1,000 ids. The record page gets those ids as its step set and the drill's count, so 「N of M」 says where the record sits in the whole drill and ↑ ↓ walk all of it. No record page, history-state shape or `DrillRecordOrigin` change. - **The read is stable and the open is live (review round 2).** The windows are read side by side, so the read's `$orderby` is the list's sort with `id` appended as the last tiebreaker (`id` alone when the list sends no sort; a sort already ending on `id` is kept), and the ids are deduplicated in order. The deferred open checks that the drill is still open and mounted and that no later click has started another open; otherwise it is dropped, so Esc or an outside click while the ids are read navigates nowhere and does not close a drill opened since. A failed read is logged once (`console.warn`) and keeps the rows drawn. - **Unchanged when nothing more is owed.** A drill whose rows drawn are its whole result opens the record at once, with no read and no promise (the existing #36256 pins hold unedited). A failed read, a record past the first 1,000, or a result that changed under the list keeps the rows drawn as the step set, as before. - Docs: `ui/packages/plugin-list/README.md` (the block's two count listeners, the new host prop). Changeset: `.changeset/36554-drill-record-steps-whole-result.md` (patch, `@object-ui/plugin-dashboard` and `@object-ui/plugin-list`). ## Tests Base `3cf6a44b`, head named in the hand-off; all runs under `os-verify-lock`, from `ui/` with `vitest run --maxWorkers=2`. - New pins: - `drillDialogStandardList-36256.test.tsx` (the real `list-view` in the real drill dialog), new describe for #36554: a drill whose read matches 40 and draws 2 opens a record with all 40 ids, in order, and `total: 40`; every id read carries the drill's condition and no write is made. Control: a drill whose 3 rows are its whole result hands `{ siblings: [d1, d2, d3], total: 3 }` and makes no id read. - `ListView.harness.test.tsx`, new describe `ListView.onFindParamsChange-36554`: a paged grid reports exactly the params of the read that drew its rows; a calendar reports `null`. - `drillRecordSteps-36554.test.ts`: the query kept and stripped, a later page read from the start, the 1,000 cap walked in windows, the list's wider window, no read (and no promise) when all is drawn, and the drawn rows kept on no query, no count, a failed read or a moved result. - Red leg: with the three source files restored from base (`git restore --source=3cf6a44b`, tests committed), the two harness describes read `Tests 4 failed | 133 skipped (137)` (`expected undefined to be 40`; the control `expected { siblings: [ 'd1', 'd2', 'd3' ] }` without `total`; `onFindParamsChange` never called). Restored with `git checkout HEAD --`; `git diff HEAD` empty. - Full runs: `packages/plugin-dashboard/ packages/plugin-list/ packages/plugin-report/` plus app-shell `drill*`, `pageBlockDrill*`, `useOpenRecordList*`, `DashboardView*`, `ReportView*` and `page-tabs-list-count-26613`: `Test Files 1 failed | 468 passed (469)` on the first head. The failure was `DrillDownDialog-36256` "the record's name opens its page with the shown rows", which asserts `openRecord` synchronously; the drill now opens at once when no read is owed (no assertion edited), and the file plus the four drill suites read `Test Files 5 passed (5), Tests 24 passed (24)`. - `type-check` (`tsc --noEmit` and `tsconfig.test.json`): `@object-ui/plugin-list`, `@object-ui/plugin-dashboard`, `@object-ui/app-shell`, each exit 0, after the `@object-ui/app-shell^...` closure build. - eslint on the changed files: 0 errors. ### Round 2 (contract review 7097462049) - New pins, red at `dc1c6c89` (the three source files restored from it, new tests kept: `Tests 8 failed | 9 passed (17)`), green at the new head (`17 passed (17)`): - `drillDialogStandardList-36256.test.tsx`: with the id reads held, closing the drill (`open` → false) and then answering the reads opens no record and closes nothing; the same after the drill unmounts; two clicks while the read is held open only the second record, with the whole step set. - `drillRecordSteps-36554.test.ts`: 150 rows tied on the list's sort across two 100-row windows, from a source that answers ties in a different order per window unless `id` settles them: every window carries `[amount desc, id asc]` and the step set is each id once, in order; `id` alone when there is no sort, an `id` sort kept as written; a boundary row two windows both answer is counted once; a failure is warned once over two failed reads. The first test's exact-params expectation now names the appended tiebreaker. - Full run: `packages/plugin-dashboard/ packages/plugin-list/ packages/plugin-report/` plus the app-shell `DashboardView*`, `ReportView*`, `drill*`, `pageBlockDrill*`, `useOpenRecordList*` tests: `Test Files 468 passed (468)`, `Tests 4742 passed | 13 skipped (4755)`. ## Gates - `dispatch-gates --commands` derived 38 families; all run, each `:: exit 0`; `--ran`: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3)". `vitest run scripts/`: `Test Files 172 passed | 2 skipped (174)`. - `check:new-line-citations`: 0 new. `check:nul-bytes`: OK. `overlap-check`: `VERDICT clean exit 0` against `origin/main` 3cf6a44, no open PR head shares a file. ## Verification Browser, the showcase app (`objectstack dev --fresh` on a random port, the Console vite server on another, both stopped after), 1440×900. Screenshots are in the project thread's files (`issue-36554/`), not inline: this branch is the only ref the session may push. 1. **「上季度」 re-check (the open acceptance line of #36256).** Revenue Pulse, date range Last quarter (2026-07-01 to 2026-09-30 on 2026-11-23): the Invoices tile reads 4. Clicking it opens the dialog with the chips 「Issued On: ≥ 2026-07-01」 and 「Issued On: ≤ 2026-09-30」, `4 records`, and the read is `filter=["and",["issued_on",">=","2026-07-01"],["issued_on","<=","2026-09-30"]]`. No non-GET request was sent from opening the drill. The record name opens the invoice page, which reads 「1 of 4 · Revenue Pulse」; Next gives 「2 of 4」. 2. **#36554.** With 48 extra invoices created in the throwaway database (60 in all), All time, the Invoices drill draws 50 rows and says `60 records`. Opening the 50th drawn row: the page reads 「50 of 60」, one id read went out (`top=100&select=id`), and Next steps to a record the drill never drew, 「51 of 60」. On main the drill never hears the count and hands only the drawn rows, which the red leg above measures in the harness; main itself was not walked in the browser. Two-minute check: run the `drillDialogStandardList-36256` file; the #36554 describe expects 40 ids and `total: 40` from a drill that draws 2. ## Acceptance notes - The id read asks for `max(list window, 100)` rows per request, and its last window reaches `$skip` 900 for a 1,000-id read. Neither limit is set by default (`packages/types/src/query-read-limits.ts`: `OS_DATA_MAX_PAGE_SIZE` "no maximum", `OS_DATA_QUERY_ROW_BUDGET` "no budget"); a deployment that sets the page size below 100 or the row budget below the walk refuses the read, and the record page then keeps the rows drawn (as before) with one console warning, not an error. - A drill matching more than 1,000 records steps through the first 1,000; the count still says the full number, and a record opened past the first 1,000 keeps the rows drawn. - The object list page has the same shape (its record page steps only through the rows it loaded); it is untouched here and noted, not filed. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No spec change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (changed files: 0 errors). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbZkNEjKLHtTo4edMVH --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZkNEjKLHtTo4edMVH)_ <!-- signed: repo:objectstack#1 · os-warren · session_01JQwxbZkNEjKLHtTo4edMVH --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4fb7169 commit 4034a6d

10 files changed

Lines changed: 652 additions & 8 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/plugin-dashboard': patch
3+
'@object-ui/plugin-list': patch
4+
---
5+
6+
fix(plugin-dashboard): a record opened from a drill counts and steps through the drill's whole result
7+
8+
Clause-②: yes (widening) — one additive member, `ListViewProps.onFindParamsChange` (`@object-ui/plugin-list`); nothing is removed or renamed
9+
Metadata-protocol: none
10+
11+
A record opened from a dashboard or report drill showed 「1 of N」 and stepped ↑ ↓ only over the rows the drill's list had drawn on its page, so a drill that matched 40 records and drew 20 let the reader walk 20. The `list-view` page block handed its own `onTotalChange` (the tab badge's count) to the list after the host's, so the drill never heard the count; it now hands the count to both. The list now also reports the query behind the rows it draws (`onFindParamsChange`, a host prop answered where `onRowsChange` answers with rows), and the drill re-issues that query for record ids alone, with the same filter, sort and search, when the count exceeds the rows drawn or the rows drawn are a later page. The record page is handed every record the drill matched, in the drill list's order, up to 1,000, and the count it matched, so its counter says where the record sits in the whole drill and ↑ ↓ walk all of it. A read that fails, a record past the first 1,000, or a result that changed under the list keeps the rows drawn as the step set, as before.

‎ui/packages/app-shell/src/views/drillDialogStandardList-36256.test.tsx‎

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,148 @@ describe('the drill dialog draws the standard list (#36256)', () => {
102102
expect(headers.slice(0, 3)).toEqual(['Name', 'Stage', 'Amount']);
103103
});
104104
});
105+
106+
/**
107+
* objectstack-ai/objectstack#36554 — a record opened from a drill steps
108+
* through the drill's whole result. The real list draws one page of the
109+
* drill (2 of 40 rows); the record page the host opens is handed all 40 ids,
110+
* read with the drill list's own query (its filter and sort, ids only), and
111+
* the count the list matched, so it reads 「1 of 40」 and ↑ ↓ walk every
112+
* record. A drill whose result is all drawn reads nothing more.
113+
*/
114+
describe('a record opened from a drill steps through the whole drill (#36554)', () => {
115+
const ALL = Array.from({ length: 40 }, (_, i) => ({
116+
id: `d${i + 1}`,
117+
name: i === 0 ? 'Acme' : `Deal ${i + 1}`,
118+
stage: 'negotiation',
119+
amount: i + 1,
120+
}));
121+
122+
function mountPaged(rows: typeof ALL, pageSize: number, { holdIdReads = false } = {}) {
123+
// With `holdIdReads`, the drill's id reads wait until `releaseIdReads()`.
124+
let releaseIdReads = () => {};
125+
const idReadsHeld = new Promise<void>((resolve) => { releaseIdReads = resolve; });
126+
const ds = {
127+
find: vi.fn(async (_object: string, params: { $top?: number; $skip?: number; $select?: string[] } = {}) => {
128+
if (holdIdReads && JSON.stringify(params.$select) === '["id"]') await idReadsHeld;
129+
const skip = params.$skip ?? 0;
130+
const top = params.$top ?? rows.length;
131+
const page = rows.slice(skip, skip + top);
132+
const select = params.$select;
133+
return {
134+
data: select ? page.map((row) => Object.fromEntries(select.map((f) => [f, (row as Record<string, unknown>)[f]]))) : page,
135+
total: rows.length,
136+
};
137+
}),
138+
findOne: vi.fn(),
139+
create: vi.fn(),
140+
update: vi.fn(),
141+
delete: vi.fn(),
142+
bulk: vi.fn(),
143+
getObjectSchema: vi.fn(async () => structuredClone(DEFINITION)),
144+
};
145+
const openRecord = vi.fn();
146+
const onClose = vi.fn();
147+
const drill = (open: boolean) => (
148+
<SchemaRendererProvider dataSource={ds as any}>
149+
<DrillNavigationProvider value={{ openRecord }}>
150+
<DrillDownDrawer
151+
open={open}
152+
target="dialog"
153+
onClose={onClose}
154+
title="Negotiation"
155+
objectName="deal_36256"
156+
filter={{ stage: 'negotiation' }}
157+
defaultColumns={['stage', 'amount']}
158+
maxRows={pageSize}
159+
dataSource={ds}
160+
/>
161+
</DrillNavigationProvider>
162+
</SchemaRendererProvider>
163+
);
164+
const view = render(drill(true));
165+
return { ds, openRecord, onClose, releaseIdReads, close: () => view.rerender(drill(false)), unmount: view.unmount };
166+
}
167+
168+
const idReads = (ds: { find: ReturnType<typeof vi.fn> }) =>
169+
ds.find.mock.calls.filter(([, params]) => JSON.stringify((params as { $select?: unknown })?.$select) === '["id"]');
170+
171+
it('hands the record page every record the drill matched, with its count, read by the drill list\'s own query', async () => {
172+
const { ds, openRecord } = mountPaged(ALL, 2);
173+
const dialog = await screen.findByTestId('drill-down-dialog');
174+
await within(dialog).findByText('Acme');
175+
// The list drew one page: 2 of the 40 rows.
176+
expect(within(dialog).queryByText('Deal 3')).toBeNull();
177+
await act(async () => fireEvent.click(within(dialog).getByText('Acme')));
178+
await waitFor(() => expect(openRecord).toHaveBeenCalledTimes(1));
179+
180+
const [objectName, recordId, origin] = openRecord.mock.calls[0];
181+
expect(objectName).toBe('deal_36256');
182+
expect(recordId).toBe('d1');
183+
expect(origin.total).toBe(40);
184+
expect(origin.siblings).toEqual(ALL.map((row) => row.id));
185+
186+
// The ids came from the drill's query: its condition, no other read shape.
187+
const reads = idReads(ds);
188+
expect(reads.length).toBeGreaterThan(0);
189+
for (const [object, params] of reads) {
190+
expect(object).toBe('deal_36256');
191+
expect(JSON.stringify((params as { $filter?: unknown }).$filter)).toContain('negotiation');
192+
}
193+
for (const write of [ds.create, ds.update, ds.delete, ds.bulk]) expect(write).not.toHaveBeenCalled();
194+
});
195+
196+
it('opens no record when the drill is closed while its result is read', async () => {
197+
const { ds, openRecord, onClose, releaseIdReads, close } = mountPaged(ALL, 2, { holdIdReads: true });
198+
const dialog = await screen.findByTestId('drill-down-dialog');
199+
await within(dialog).findByText('Acme');
200+
await act(async () => fireEvent.click(within(dialog).getByText('Acme')));
201+
await waitFor(() => expect(idReads(ds).length).toBeGreaterThan(0));
202+
203+
// The reader closes the drill (Esc, an outside click) before the ids come back.
204+
act(() => close());
205+
await waitFor(() => expect(screen.queryByTestId('drill-down-dialog')).toBeNull());
206+
await act(async () => { releaseIdReads(); await Promise.resolve(); });
207+
await new Promise((resolve) => setTimeout(resolve, 0));
208+
expect(openRecord).not.toHaveBeenCalled();
209+
expect(onClose).not.toHaveBeenCalled();
210+
});
211+
212+
it('opens no record when the drill is gone while its result is read', async () => {
213+
const { ds, openRecord, onClose, releaseIdReads, unmount } = mountPaged(ALL, 2, { holdIdReads: true });
214+
const dialog = await screen.findByTestId('drill-down-dialog');
215+
await within(dialog).findByText('Acme');
216+
await act(async () => fireEvent.click(within(dialog).getByText('Acme')));
217+
await waitFor(() => expect(idReads(ds).length).toBeGreaterThan(0));
218+
219+
unmount();
220+
await act(async () => { releaseIdReads(); await Promise.resolve(); });
221+
await new Promise((resolve) => setTimeout(resolve, 0));
222+
expect(openRecord).not.toHaveBeenCalled();
223+
expect(onClose).not.toHaveBeenCalled();
224+
});
225+
226+
it('opens the record clicked last when a second record is clicked while the first is read', async () => {
227+
const { openRecord, releaseIdReads } = mountPaged(ALL, 2, { holdIdReads: true });
228+
const dialog = await screen.findByTestId('drill-down-dialog');
229+
await within(dialog).findByText('Deal 2');
230+
await act(async () => fireEvent.click(within(dialog).getByText('Acme')));
231+
await act(async () => fireEvent.click(within(dialog).getByText('Deal 2')));
232+
await act(async () => { releaseIdReads(); await Promise.resolve(); });
233+
await waitFor(() => expect(openRecord).toHaveBeenCalled());
234+
await new Promise((resolve) => setTimeout(resolve, 0));
235+
expect(openRecord).toHaveBeenCalledTimes(1);
236+
expect(openRecord.mock.calls[0][1]).toBe('d2');
237+
expect(openRecord.mock.calls[0][2]).toEqual({ siblings: ALL.map((row) => row.id), total: 40 });
238+
});
239+
240+
it('control: a drill whose result is all drawn hands those rows and reads nothing more', async () => {
241+
const { ds, openRecord } = mountPaged(ALL.slice(0, 3), 10);
242+
const dialog = await screen.findByTestId('drill-down-dialog');
243+
await within(dialog).findByText('Deal 3');
244+
await act(async () => fireEvent.click(within(dialog).getByText('Acme')));
245+
await waitFor(() => expect(openRecord).toHaveBeenCalledTimes(1));
246+
expect(openRecord.mock.calls[0][2]).toEqual({ siblings: ['d1', 'd2', 'd3'], total: 3 });
247+
expect(idReads(ds)).toHaveLength(0);
248+
});
249+
});

‎ui/packages/plugin-dashboard/src/DrillDownDrawer.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export const DrillDownDrawer: React.FC<DrillDownDrawerProps> = ({
257257
maxRows={maxRows}
258258
dataSource={dataSource}
259259
onNavigate={onClose}
260+
open={open}
260261
/>
261262
)
262263
: (

‎ui/packages/plugin-dashboard/src/DrillRecordList.tsx‎

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
* no create, no bulk action, no view switch, no saved view.
2121
*
2222
* The record's name opens its full page through the host
23-
* (`DrillNavigationContext.openRecord`, item 6), with the rows the list shows
24-
* as the page's ↑ ↓ set and the count it matched; no record panel is stacked
25-
* over the drill. A host with no record page (a page block's metric or pivot
23+
* (`DrillNavigationContext.openRecord`, item 6), with the drill's whole
24+
* result as the page's ↑ ↓ set and the count it matched (`drillRecordOrigin`,
25+
* objectstack-ai/objectstack#36554: the rows past the page drawn are read by
26+
* the list's own query); no record panel is stacked over the drill. A host with no record page (a page block's metric or pivot
2627
* mounts no navigation) opens the record in a dialog showing the fields the
2728
* list lists: the list reads only those (`$select`), so a field it did not
2829
* read is not drawn as empty.
@@ -35,10 +36,12 @@ import React from 'react';
3536
import { PageRegionPostureReset } from '@object-ui/components';
3637
import { ComponentRegistry, resolveFilterPlaceholders, resolveNameField } from '@object-ui/core';
3738
import { SchemaRenderer, SchemaRendererContext, useDrillNavigation, useFilterScope } from '@object-ui/react';
39+
import type { DrillRecordOrigin } from '@object-ui/react';
3840
import { FILTER_DATE_LIKE_TYPES } from '@object-ui/types';
3941
import { Loader2 } from 'lucide-react';
4042
import { RecordDetailDrawer } from './RecordDetailDrawer';
4143
import { drillListConditions } from './drillConditions';
44+
import { drillRecordOrigin } from './drillRecordSteps';
4245

4346
/** The registry key of the standard list (`@object-ui/plugin-list`). */
4447
export const DRILL_LIST_COMPONENT = 'list-view';
@@ -61,6 +64,11 @@ export interface DrillRecordListProps {
6164
dataSource?: any;
6265
/** Called after the host opened a record's page. */
6366
onNavigate?: () => void;
67+
/**
68+
* Whether the drill's dialog is open (default: open). A record whose step
69+
* set is still being read when it closes is not opened.
70+
*/
71+
open?: boolean;
6472
}
6573

6674
type Summary = string | Record<string, unknown>;
@@ -81,6 +89,7 @@ export const DrillRecordList: React.FC<DrillRecordListProps> = ({
8189
maxRows,
8290
dataSource: ownDataSource,
8391
onNavigate,
92+
open: dialogOpen = true,
8493
}) => {
8594
const context = React.useContext(SchemaRendererContext);
8695
const dataSource = ownDataSource ?? context?.dataSource;
@@ -116,7 +125,19 @@ export const DrillRecordList: React.FC<DrillRecordListProps> = ({
116125

117126
const [added, setAdded] = React.useState<string[]>([]);
118127
const [summaries, setSummaries] = React.useState<Record<string, Summary>>({});
119-
const shown = React.useRef<{ ids: string[]; total?: number }>({ ids: [] });
128+
const shown = React.useRef<{
129+
ids: string[];
130+
total?: number;
131+
findParams?: Readonly<Record<string, unknown>> | null;
132+
}>({ ids: [] });
133+
// The record a click asks for while its step set is read: the last click
134+
// wins, and none opens once the drill is closed or gone (objectstack#36554).
135+
const lastOpen = React.useRef(0);
136+
const live = React.useRef(dialogOpen);
137+
React.useLayoutEffect(() => {
138+
live.current = dialogOpen;
139+
return () => { live.current = false; };
140+
}, [dialogOpen]);
120141
const [opened, setOpened] = React.useState<Record<string, unknown> | null>(null);
121142

122143
const baseColumns = React.useMemo(() => {
@@ -173,14 +194,24 @@ export const DrillRecordList: React.FC<DrillRecordListProps> = ({
173194
shown.current = { ...shown.current, ids: rows.map(rowId).filter((id): id is string => !!id) };
174195
}}
175196
onTotalChange={(total: number) => { shown.current = { ...shown.current, total }; }}
197+
onFindParamsChange={(findParams: Readonly<Record<string, unknown>> | null) => {
198+
shown.current = { ...shown.current, findParams };
199+
}}
176200
rowOpensRecord
177201
onRowClick={(record: Record<string, unknown>) => {
178202
if (!openRecord) return setOpened(record);
179203
const id = rowId(record);
180204
if (!id) return;
181-
const { ids, total } = shown.current;
182-
openRecord(objectName, id, { siblings: ids.includes(id) ? ids : [id], ...(total != null ? { total } : {}) });
183-
onNavigate?.();
205+
const click = ++lastOpen.current;
206+
const open = (origin: DrillRecordOrigin) => {
207+
if (click !== lastOpen.current || !live.current) return;
208+
openRecord(objectName, id, origin);
209+
onNavigate?.();
210+
};
211+
const { ids, total, findParams } = shown.current;
212+
const origin = drillRecordOrigin({ dataSource, objectName, recordId: id, drawn: ids, total, findParams });
213+
if (origin instanceof Promise) void origin.then(open);
214+
else open(origin);
184215
}}
185216
/>
186217
{!openRecord && (

0 commit comments

Comments
 (0)