Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit be0ad00

Browse files
fix(plugin-grid,plugin-list): the grid and the list re-read when a harvested query input changes (objectui#10689) (#11280)
Fixes #10689 Clause-②: no `ObjectGrid`'s load effect and `ListView`'s fetch effect now re-read when an input their query reads changes, and only then. This is the objectui#10664 family rule ("every input the query reads is in the effect's dependencies"), in PR objectui#10688's shape: each input is keyed by content, as a string compared by value (AGENTS.md #10). What the query selects is unchanged; only when it re-reads moves. ## The rows, re-derived on `main` (`18d1a0abd3`) | Row | Input the query reads | In the effect's dependencies at base? | Change | |:--|:--|:--|:--| | grid (`ObjectGrid` load effect) | `conditionalFormatting` (predicate-operand harvest) | no | `predicateProjectionKey` | | grid | `rowActionDefs` (harvest) | no | `predicateProjectionKey` | | grid | `bulkActionDefs` (harvest) | no | `predicateProjectionKey` | | grid | `searchableFields` (`$searchFields`) | no | `searchFieldsKey` | | list (`ListView` fetch effect) | `conditionalFormatting` (harvest) | no | `predicateProjectionKey` | | list | `rowActionDefs` (harvest) | no | `predicateProjectionKey` | | list | `bulkActionDefs` (harvest) | no | `predicateProjectionKey` | | list | `searchableFields` (`$searchFields`) | yes (`schema.searchableFields`, by identity) | none: already re-reads on main, pinned only | ## The keys - `predicateProjectionKey`, in both files: `JSON.stringify(collectPredicateFieldRefs(listViewPredicates({ conditionalFormatting, rowActionDefs, bulkActionDefs })))`. It is the same harvest over the same three view-level inputs that the effect runs. It keys on the operand NAMES, the shape `groupingProjectionKey` already takes for `grouping` in the grid, so a rule's style or an action's label costs no round trip. The object-level `actions` / `userActions` the effect adds come from the object definition, not the view, and stay outside the key. - `searchFieldsKey`, in the grid: the `$searchFields` the query sends. It is `JSON.stringify(searchableFields)` while a term goes out, and `''` otherwise, because without a term the query does not send them. - No new helper. PR objectui#10688 added no named key helper: its keys are inline `JSON.stringify(...)` strings (`sortKey`, `optionsFilterKey`, `tableSortKey`) or a computed projection (`lookupExpandKey`). These two keys follow that shape. - The inputs are read through typed casts (`{ rowActionDefs?: readonly unknown[] }`, the way the grid already reads `bulkActionDefs` for its diagnostic), so the dependency lists hold simple names. The `rowActionDefs` read is the objectui#5091 NON-AUTHOR SURFACE exemption, as at the effects' own reads. ## Red first, then ablation Red first, at base. The two pin files, at their committed bytes, were run against the source at `18d1a0abd3`: - grid: `Tests 4 failed | 4 passed (8)`. The four defect rows were red (for the rule, `$select` stayed `[['id','name']]`), and the controls were green. - list: `Tests 3 failed | 4 passed (7)`. The three defect rows were red. The list `searchableFields` pin was green, because that row was already keyed on main. Ablation at head `1842dc0f83`, through `ablation-replace.mjs`. The anchor hit went 1 to 0, and the restore was proven: blob equal to HEAD, `git diff HEAD` empty. No `dist` leg was needed, because the pins import the components relatively from `src`. - grid, with `predicateProjectionKey, searchFieldsKey` dropped from the dependencies: `Tests 4 failed | 4 passed (8)`, the same four rows. - list, with `predicateProjectionKey` dropped: `Tests 3 failed | 4 passed (7)`, the same three rows. ## Pins (each counts `find` calls) - `packages/plugin-grid/src/__tests__/ObjectGrid.harvestInputsFetchKey-10689.test.tsx`: - A fresh mount with the rule reads once, with `$select` `['id','name','industry']`. - A rule, a row def or a bulk def added to a mounted grid re-reads exactly once, with its operand. - `searchableFields` changed under a term re-reads once, with the new `$searchFields`. - Controls that add zero reads: an equal re-render (new arrays with the same content, all four inputs); a style-only rule change; a `searchableFields` change with no term. - `packages/plugin-list/src/__tests__/ListView.harvestInputsFetchKey-10689.test.tsx`: the same cases for the list's three inputs, plus the already-keyed `searchableFields` row. ## Verification at head `1842dc0f83` - Build: `pnpm --workspace-concurrency=2 --filter '@object-ui/plugin-list^...' --filter '@object-ui/plugin-grid^...' build` exited 0. Both closures are needed: `plugin-list^...` alone does not contain `plugin-grid`'s `plugin-detail`, `data-objectstack` and `sdui-parser`. - Type-check: `pnpm --filter @object-ui/plugin-grid type-check` and `pnpm --filter @object-ui/plugin-list type-check` exited 0. `tsc -p tsconfig.test.json --listFiles` lists each new pin file. - Tests: - `pnpm exec vitest run packages/plugin-list/`: `Test Files 110 passed (110)`, `Tests 1208 passed (1208)`. - `packages/plugin-grid/` ran in two chunks. Its 177 test files were split 88 + 89, and the union was checked against the full list. Results: `88 passed (88)` / `766 passed (766)`, and `89 passed (89)` / `855 passed (855)`. - Checks, each exit 0: - `check:new-line-citations`: `VERDICT new-cross-file-line-citations: 0 new citation(s)`. - `scripts/check-changeset-presence.mjs`: 4 source files of 2 released packages, 2 changesets. - `changeset:check`, `check:control-bytes`, `check:action-forward-parity`, `check:i18n-keys`, `check:spec-symbols`, `check:test-path-roots`, `check:vi-mock-specifiers`, `check:vi-mock-inherit` and `check:icon-record-names`. - Lint, narrowed to the four changed files (the tree-wide `pnpm lint` run is CI's): - None of the four is ignored by `eslint.config.js`: `eslint --print-config` resolves each one. - `eslint --format json` over them reported 4 files and 0 errors. - `ObjectGrid.tsx` and `ListView.tsx` carry the same warning counts as at base. - The narrowing excludes nothing. The config enables no type-aware linting (no `parserOptions.project` / `projectService`), and no rule under `eslint-rules/` reads the filesystem, so this diff cannot move the verdict on any untouched file. ## Acceptance notes - `ListView` names `schema.searchableFields` by identity in its fetch dependencies. A throwaway probe (deleted, never committed) measured it: an equal `searchableFields` in a new array, under a search term, re-reads (2 `find`). It is not edited here, for two reasons. The ruling says a row that already re-reads on main is pinned, not re-edited. And that effect's own comment records the objectui#4567 ruling that its by-identity dependencies stay, with stabilisation at the producer. No producer was measured rebuilding the array on every render. Carrier: none. - No README or guide changes: when a view re-reads is not documented behaviour for either block. ## Changesets - `.changeset/10689-grid-harvest-inputs-refetch.md` (`@object-ui/plugin-grid`: patch) - `.changeset/10689-list-harvest-inputs-refetch.md` (`@object-ui/plugin-list`: patch) Session: `session_0122Knsowci76D2rBWReCzzZ`, seat `domain:ui#1`, claim comment 5920079312. --- _Generated by [Claude Code](https://claude.ai/code/session_0122Knsowci76D2rBWReCzzZ)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7fed09d commit be0ad00

6 files changed

Lines changed: 499 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@object-ui/plugin-grid': patch
3+
---
4+
5+
`object-grid` re-reads its rows when an input its query reads changes: a `conditionalFormatting` rule, a row or bulk action def, or the view's `searchableFields` (objectui#10689).
6+
7+
The grid puts each predicate operand of its `conditionalFormatting` rules and its row and bulk action defs into `$select`, and sends `searchableFields` as `$searchFields` beside a search term, but its load effect did not re-run when any of them changed. So a rule added to a mounted grid never had its field fetched, and the rule never matched. The effect now keys on the operand names and on the `$searchFields` it sends, both by content, so an equal value in a new array, or a change the query cannot see such as a rule's colour, does not re-read.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@object-ui/plugin-list': patch
3+
---
4+
5+
`list-view` re-reads its rows when a `conditionalFormatting` rule, a row action def or a bulk action def adds a field its predicates read (objectui#10689).
6+
7+
The list puts each predicate operand of those three into `$select`, but its fetch effect did not re-run when any of them changed. So a rule added to a mounted list never had its field fetched, and the rule never matched. The effect now keys on the operand names by content, so an equal value in a new array, or a change the query cannot see such as a rule's colour, does not re-read.

‎packages/plugin-grid/src/ObjectGrid.tsx‎

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,34 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
19611961
() => JSON.stringify(collectGroupingFieldRefs(schema.grouping)),
19621962
[schema.grouping],
19631963
);
1964+
// [objectui#10689] The fetch effect's dep on the three view-level PREDICATE
1965+
// carriers its projection harvests (objectui#3501), as a CONTENT key over the
1966+
// operand NAMES alone, the shape `groupingProjectionKey` takes above.
1967+
//
1968+
// The load effect reads `conditionalFormatting`, `rowActionDefs` and
1969+
// `bulkActionDefs` through `listViewPredicates` and puts each operand into
1970+
// `$select`, but none of the three was a dependency. So a rule added to a
1971+
// mounted grid never had its operand fetched: the rows kept arriving without
1972+
// the field, and the rule, which reads it, never matched.
1973+
//
1974+
// Names ONLY: a rule's style, or an action's label, is a render-time concern
1975+
// the projection cannot see, so changing it costs no round trip. The same
1976+
// harvest over the same three inputs as the effect's; the object-level
1977+
// `actions` / `userActions` it adds come from the definition the effect reads
1978+
// for itself. The `rowActionDefs` cast is the objectui#5091 NON-AUTHOR
1979+
// SURFACE exemption stated at the effect's own read of that key.
1980+
// `__tests__/ObjectGrid.harvestInputsFetchKey-10689.test.tsx` pins each input.
1981+
const conditionalFormattingRaw = schema.conditionalFormatting as readonly unknown[] | undefined;
1982+
const rowActionDefsRaw = (schema as { rowActionDefs?: readonly unknown[] }).rowActionDefs;
1983+
const bulkActionDefsRaw = (schema as { bulkActionDefs?: readonly unknown[] }).bulkActionDefs;
1984+
const predicateProjectionKey = useMemo(
1985+
() => JSON.stringify(collectPredicateFieldRefs(listViewPredicates({
1986+
conditionalFormatting: conditionalFormattingRaw,
1987+
rowActionDefs: rowActionDefsRaw,
1988+
bulkActionDefs: bulkActionDefsRaw,
1989+
}))),
1990+
[conditionalFormattingRaw, rowActionDefsRaw, bulkActionDefsRaw],
1991+
);
19641992
// The view's declared filter, lowered ONCE through the repo's single filter
19651993
// sink for both consumers below (the fetch and the server-side export).
19661994
//
@@ -2050,6 +2078,15 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
20502078
// is the one typed into this grid's box.
20512079
const hostOwnsSearch = externalManualPagination || hostSearch !== undefined;
20522080
const querySearchTerm = hostOwnsSearch ? (hostSearch ?? '') : searchTerm;
2081+
// [objectui#10689] The `$searchFields` the load effect sends, as a CONTENT
2082+
// key for its dependency list: the view's `searchableFields`, and only while
2083+
// a term goes out, since without one the query does not send them. A view
2084+
// that narrows its search to other fields re-reads once; an equal array in a
2085+
// new object does not.
2086+
const searchFieldsKey =
2087+
querySearchTerm.trim() && schema.searchableFields && schema.searchableFields.length > 0
2088+
? JSON.stringify(schema.searchableFields)
2089+
: '';
20532090

20542091
// --- Inline data effect (synchronous, no fetch needed) ---
20552092
useEffect(() => {
@@ -2819,7 +2856,10 @@ export const ObjectGrid: React.FC<ObjectGridComponentProps> = ({
28192856
// `groupingNeedsHeaderQuery` (objectui#10881): it flips when the object's
28202857
// types land and show the only grouping key masked, and the flat fetch it
28212858
// withheld must then go out.
2822-
}, [objectName, schemaFields, schemaColumns, schemaFilter, schemaFilterRefusal, schemaDefaultFilters, schemaSort, headerSort, querySearchTerm, schemaPagination, schemaPageSize, serverPage, fetchWindow, dataSource, hasInlineData, dataConfig, refreshKey, perms.isLoaded, groupingProjectionKey, invalidationNonce, serverGroupedFetch, groupingNeedsHeaderQuery]);
2859+
// `predicateProjectionKey` and `searchFieldsKey` (objectui#10689): the
2860+
// harvested predicate operands and the `$searchFields` this query sends, each
2861+
// a string compared by value — see their declarations above.
2862+
}, [objectName, schemaFields, schemaColumns, schemaFilter, schemaFilterRefusal, schemaDefaultFilters, schemaSort, headerSort, querySearchTerm, schemaPagination, schemaPageSize, serverPage, fetchWindow, dataSource, hasInlineData, dataConfig, refreshKey, perms.isLoaded, groupingProjectionKey, predicateProjectionKey, searchFieldsKey, invalidationNonce, serverGroupedFetch, groupingNeedsHeaderQuery]);
28232863

28242864
// The same reset, for the path the loader above never runs on (objectui#4501
28252865
// clause 2). "All N matching are selected" is a claim about ONE query, so it
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
/**
10+
* objectui#10689 — `ObjectGrid`'s load effect re-reads when an input its query
11+
* reads changes, and only then. The objectui#10664 family rule: every input the
12+
* query reads is in the effect's dependencies, keyed by content.
13+
*
14+
* The query reads four schema inputs that the dependency list did not name:
15+
*
16+
* - `conditionalFormatting`, `rowActionDefs` and `bulkActionDefs`, through the
17+
* predicate-operand harvest (objectui#3501) that puts each predicate's
18+
* operands into `$select`;
19+
* - `searchableFields`, sent as `$searchFields` beside a search term.
20+
*
21+
* So a rule added to a mounted grid never had its operand fetched: the rows
22+
* kept arriving without the field, and the rule, which reads it, never matched.
23+
*
24+
* Each input is keyed by the part of it the query reads, as a string compared
25+
* by value (AGENTS.md #10): the harvested operand NAMES for the three predicate
26+
* carriers (the shape `groupingProjectionKey` already takes for `grouping`), and
27+
* the `$searchFields` the query sends. So an equal re-render, or a change the
28+
* query cannot see (a rule's colour), costs no round trip.
29+
*/
30+
import { describe, it, expect, vi, beforeAll, afterEach } from 'vitest';
31+
import { render, waitFor, act, cleanup } from '@testing-library/react';
32+
import '@testing-library/jest-dom';
33+
import React from 'react';
34+
35+
import { ObjectGrid } from '../ObjectGrid';
36+
import { registerAllFields } from '@object-ui/fields';
37+
38+
registerAllFields();
39+
40+
beforeAll(() => {
41+
if (!Element.prototype.scrollIntoView) {
42+
Element.prototype.scrollIntoView = vi.fn() as any;
43+
}
44+
});
45+
46+
afterEach(() => cleanup());
47+
48+
const OBJECT = 'account';
49+
50+
// Held as module constants so every re-render below hands the grid the SAME
51+
// references for the inputs this card does not touch. `columns` and
52+
// `pagination` are named by identity in the effect's dependency list, so a
53+
// fresh literal of either would re-read for a reason of its own.
54+
const COLUMNS = [{ field: 'name', label: 'Name' }];
55+
const PAGINATION = { pageSize: 50 };
56+
57+
function makeDataSource() {
58+
const find = vi.fn(async () => ({
59+
data: [{ id: 'r1', name: 'Acme', industry: 'Tech', owner: 'u1', status: 'open', region: 'EU' }],
60+
total: 1,
61+
hasMore: false,
62+
pageSize: 50,
63+
}));
64+
return {
65+
find,
66+
getObjectSchema: async (name: string) => ({
67+
name,
68+
fields: {
69+
id: { type: 'text' },
70+
name: { type: 'text' },
71+
industry: { type: 'text' },
72+
owner: { type: 'text' },
73+
status: { type: 'text' },
74+
region: { type: 'text' },
75+
},
76+
}),
77+
} as any;
78+
}
79+
80+
const gridSchema = (extra: Record<string, unknown> = {}): any => ({
81+
type: 'object-grid',
82+
objectName: OBJECT,
83+
columns: COLUMNS,
84+
pagination: PAGINATION,
85+
...extra,
86+
});
87+
88+
/** Long enough for any effect a step schedules to have run and settled. */
89+
const settle = () => act(() => new Promise<void>((resolve) => setTimeout(resolve, 150)));
90+
91+
const selects = (find: ReturnType<typeof vi.fn>) =>
92+
find.mock.calls.map((call: any[]) => call[1]?.$select as string[] | undefined);
93+
94+
/** Mount, wait for the first read to land, and settle every follow-up effect. */
95+
async function mount(ds: any, extra: Record<string, unknown> = {}, props: Record<string, unknown> = {}) {
96+
const view = render(<ObjectGrid schema={gridSchema(extra)} dataSource={ds} {...props} />);
97+
await waitFor(() => expect(ds.find).toHaveBeenCalled());
98+
await settle();
99+
const rerender = async (next: Record<string, unknown>, nextProps: Record<string, unknown> = props) => {
100+
view.rerender(<ObjectGrid schema={gridSchema(next)} dataSource={ds} {...nextProps} />);
101+
await settle();
102+
};
103+
return { rerender };
104+
}
105+
106+
const INDUSTRY_RULE = { condition: "record.industry == 'Tech'", style: { backgroundColor: '#fee2e2' } };
107+
const ROW_DEF = { name: 'escalate', label: 'Escalate', visible: "record.owner == 'u1'" };
108+
const BULK_DEF = { name: 'archive', label: 'Archive', disabled: "record.status == 'closed'" };
109+
110+
describe('ObjectGrid re-reads when a harvested predicate input changes (objectui#10689)', () => {
111+
it('CONTROL — a fresh mount with the rule selects its operand, in one read', async () => {
112+
const ds = makeDataSource();
113+
await mount(ds, { conditionalFormatting: [INDUSTRY_RULE] });
114+
expect(selects(ds.find)).toEqual([['id', 'name', 'industry']]);
115+
});
116+
117+
it('a `conditionalFormatting` rule added to a mounted grid re-reads once, with its operand in `$select`', async () => {
118+
const ds = makeDataSource();
119+
const { rerender } = await mount(ds);
120+
expect(selects(ds.find)).toEqual([['id', 'name']]);
121+
122+
await rerender({ conditionalFormatting: [INDUSTRY_RULE] });
123+
124+
expect(
125+
selects(ds.find),
126+
'The rule was added to a mounted grid and the grid never re-read, so the rows keep\n'
127+
+ 'arriving without `industry` and the rule never matches. The load effect must name\n'
128+
+ 'the harvested operands in its dependencies (objectui#10689).',
129+
).toEqual([['id', 'name'], ['id', 'name', 'industry']]);
130+
});
131+
132+
it('a `rowActionDefs` def added to a mounted grid re-reads once, with its `visible` operand', async () => {
133+
const ds = makeDataSource();
134+
const { rerender } = await mount(ds);
135+
136+
await rerender({ rowActionDefs: [ROW_DEF] });
137+
138+
expect(selects(ds.find)).toEqual([['id', 'name'], ['id', 'name', 'owner']]);
139+
});
140+
141+
it('a `bulkActionDefs` def added to a mounted grid re-reads once, with its `disabled` operand', async () => {
142+
const ds = makeDataSource();
143+
const { rerender } = await mount(ds);
144+
145+
await rerender({ bulkActionDefs: [BULK_DEF] });
146+
147+
expect(selects(ds.find)).toEqual([['id', 'name'], ['id', 'name', 'status']]);
148+
});
149+
150+
it('CONTROL — an equal re-render (new arrays, same content) does not re-read', async () => {
151+
const ds = makeDataSource();
152+
const { rerender } = await mount(ds, {
153+
conditionalFormatting: [INDUSTRY_RULE],
154+
rowActionDefs: [ROW_DEF],
155+
bulkActionDefs: [BULK_DEF],
156+
searchableFields: ['name', 'industry'],
157+
}, { search: 'acme' });
158+
expect(ds.find).toHaveBeenCalledTimes(1);
159+
160+
await rerender({
161+
conditionalFormatting: [{ ...INDUSTRY_RULE, style: { ...INDUSTRY_RULE.style } }],
162+
rowActionDefs: [{ ...ROW_DEF }],
163+
bulkActionDefs: [{ ...BULK_DEF }],
164+
searchableFields: ['name', 'industry'],
165+
}, { search: 'acme' });
166+
167+
expect(ds.find, 'an equal re-render must cost no round trip').toHaveBeenCalledTimes(1);
168+
});
169+
170+
it('a rule change the query cannot see (its style) does not re-read', async () => {
171+
const ds = makeDataSource();
172+
const { rerender } = await mount(ds, { conditionalFormatting: [INDUSTRY_RULE] });
173+
174+
await rerender({
175+
conditionalFormatting: [{ ...INDUSTRY_RULE, style: { backgroundColor: '#dcfce7' } }],
176+
});
177+
178+
expect(ds.find).toHaveBeenCalledTimes(1);
179+
});
180+
});
181+
182+
describe('ObjectGrid re-reads when `searchableFields` changes under a search term (objectui#10689)', () => {
183+
const searchFieldsOf = (find: ReturnType<typeof vi.fn>) =>
184+
find.mock.calls.map((call: any[]) => call[1]?.$searchFields as string[] | undefined);
185+
186+
it('`searchableFields` changed on a mounted grid re-reads once, with the new `$searchFields`', async () => {
187+
const ds = makeDataSource();
188+
const { rerender } = await mount(ds, { searchableFields: ['name'] }, { search: 'acme' });
189+
expect(searchFieldsOf(ds.find)).toEqual([['name']]);
190+
191+
await rerender({ searchableFields: ['name', 'region'] }, { search: 'acme' });
192+
193+
expect(
194+
searchFieldsOf(ds.find),
195+
'The view narrowed its search to new fields and the grid never re-read, so the rows on\n'
196+
+ 'screen still answer the old `$searchFields` (objectui#10689).',
197+
).toEqual([['name'], ['name', 'region']]);
198+
});
199+
200+
it('without a search term `$searchFields` is not sent, so a change to it does not re-read', async () => {
201+
const ds = makeDataSource();
202+
const { rerender } = await mount(ds, { searchableFields: ['name'] });
203+
expect(searchFieldsOf(ds.find)).toEqual([undefined]);
204+
205+
await rerender({ searchableFields: ['name', 'region'] });
206+
207+
expect(ds.find).toHaveBeenCalledTimes(1);
208+
});
209+
});

‎packages/plugin-list/src/ListView.tsx‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,37 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
22542254
!Array.isArray(schema.data) && (schema.data as any)?.provider !== 'value' && !ganttOwnsData;
22552255
const invalidationNonce = useDataInvalidation(listFetchesForItself ? schema.objectName || undefined : undefined);
22562256

2257+
// objectui#10689 — the fetch effect's dep on the three view-level PREDICATE
2258+
// carriers its projection harvests (objectui#3501), as a CONTENT key over the
2259+
// operand NAMES alone: the shape `plugin-grid`'s `predicateProjectionKey`
2260+
// takes for the grid's own load effect.
2261+
//
2262+
// The effect below reads `conditionalFormatting`, `rowActionDefs` and
2263+
// `bulkActionDefs` through `listViewPredicates` and adds each operand to
2264+
// `$select`, but none of the three was a dependency. So a rule added to a
2265+
// mounted list never had its operand fetched: the rows kept arriving without
2266+
// the field, and the rule, which reads it, never matched.
2267+
//
2268+
// Names ONLY: a rule's style, or an action's label, is a render-time concern
2269+
// the projection cannot see, so changing it costs no round trip. The same
2270+
// harvest over the same three inputs as the effect's; the object-level
2271+
// `actions` / `userActions` it adds come from `objectDef`, not from the view,
2272+
// and are outside this key. The `rowActionDefs` cast is
2273+
// the NON-AUTHOR SURFACE exemption stated at the effect's own read of that
2274+
// key. `__tests__/ListView.harvestInputsFetchKey-10689.test.tsx` pins each
2275+
// input.
2276+
const conditionalFormattingRaw = schema.conditionalFormatting as readonly unknown[] | undefined;
2277+
const rowActionDefsRaw = (schema as { rowActionDefs?: readonly unknown[] }).rowActionDefs;
2278+
const bulkActionDefsRaw = (schema as { bulkActionDefs?: readonly unknown[] }).bulkActionDefs;
2279+
const predicateProjectionKey = React.useMemo(
2280+
() => JSON.stringify(collectPredicateFieldRefs(listViewPredicates({
2281+
conditionalFormatting: conditionalFormattingRaw,
2282+
rowActionDefs: rowActionDefsRaw,
2283+
bulkActionDefs: bulkActionDefsRaw,
2284+
}))),
2285+
[conditionalFormattingRaw, rowActionDefsRaw, bulkActionDefsRaw],
2286+
);
2287+
22572288
// Fetch data effect — supports schema.data (ViewDataSchema) provider modes
22582289
React.useEffect(() => {
22592290
let isMounted = true;
@@ -2843,13 +2874,16 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
28432874
// down. It reads `currentView`, so leaving a refused grouped grid for a
28442875
// board re-runs this effect once, and that run is the board's fetch.
28452876
//
2877+
// objectui#10689 — `predicateProjectionKey` is the harvested predicate
2878+
// operands, a string compared by value; see its declaration above.
2879+
//
28462880
// ⚠️ The directive below governs the NEXT LINE. Anything written between it
28472881
// and the dependency array detaches it from the array and turns it into an
28482882
// unused directive — which `eslint .` reports as an ERROR, and which also
28492883
// silently un-suppresses nothing, because the finding it was suppressing
28502884
// simply moves elsewhere. Add prose ABOVE this point, never below it.
28512885
// eslint-disable-next-line react-hooks/exhaustive-deps
2852-
}, [schema.objectName, schema.data, dataSource, authoredFilter, effectivePageSize, currentSort, appliedFilters, appliedUserFilterConditions, refreshKey, searchTerm, schema.searchableFields, schema.columns, (schema as any).kanban, (schema as any).calendar, (schema as any).gallery, (schema as any).timeline, (schema as any).gantt, schema.map, (schema as any).options, objectDef?.fields, objectDefLoaded, schema.refreshTrigger, perms, fetchSkip, groupingConfig, ganttOwnsData, invalidationNonce, groupingNeedsHeaderQuery]); // Re-fetch on filter/sort/search/refreshTrigger/perms/window change
2886+
}, [schema.objectName, schema.data, dataSource, authoredFilter, effectivePageSize, currentSort, appliedFilters, appliedUserFilterConditions, refreshKey, searchTerm, schema.searchableFields, schema.columns, (schema as any).kanban, (schema as any).calendar, (schema as any).gallery, (schema as any).timeline, (schema as any).gantt, schema.map, (schema as any).options, objectDef?.fields, objectDefLoaded, schema.refreshTrigger, perms, fetchSkip, groupingConfig, predicateProjectionKey, ganttOwnsData, invalidationNonce, groupingNeedsHeaderQuery]); // Re-fetch on filter/sort/search/refreshTrigger/perms/window change
28532887

28542888
// Any change to the result-defining inputs (object, filters, sort, search,
28552889
// grouping, page size) invalidates the current page number — snap back to

0 commit comments

Comments
 (0)