Skip to content

Commit 0628e08

Browse files
perf(fields): the line-item grid's body loads on first use, out of the console's eager chunk (#36417)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbUq2j5tRRVo3TVY3wcS1Fdg)_ repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ Fixes #36102 Clause-②: yes (widening) Metadata-protocol: none Ruling-ref: 7063116595 on #36023 (option B, "a separate card follows to take GridField out of the eager chunk, after which the ceiling can come back down"); seat note 7064483594 on this card, on ruling 7063869131 (lower the ceiling and baseline by the bytes taken out, no more) ## 维护者速读 - 用户无感:控制台首次加载少下载约 6 KB(压缩后),明细表格改为第一次打开带明细的表单时才加载,新建与编辑发票时表格照常出现、输入不丢焦点。 - 这是上次为放行明细表格改动而临时抬高控制台首屏体积上限之后约定的后续工作,把那部分体积收回来。 - 出错时最坏:明细表格的代码要单独下载,如果连续两次下载失败,错误会交给表单的出错处理,整个带明细的表单(不只是明细表格)会换成出错提示;网络正常时只是第一次打开时明细区多停一会儿在「正在加载列」。整个改动可直接撤回。 - 要你做什么:无。 ## What changes The line-item grid's body (`GridField`, about 90 KB of source) sat in the console's eager `ui-components` chunk. The package entry imported it lazily but also exported it statically, so the lazy import did nothing. It now loads the first time a grid is drawn, in a lazy `fields-grid` chunk. No published export was removed or renamed. - **`ui/packages/fields/src/widgets/GridField.ts`** (new, the published face). It keeps the pure helpers (`evalArith`, `computeRow`, `lookupAutofillPatch`, `columnHelpByField`, `UNTOUCHED_NEW_ROW`, `isUntouchedNewRow` and the column types), which stay eager. It also exports `GridField` and `LineItemsField` as a small lazy face with the same props. - Each mount decides once: a grid mounted after the body has loaded renders it directly. A grid mounted before that renders it through `Suspense`, with a busy placeholder (`grid-field-loading`). - A load landing later therefore never remounts the body, and focus is kept. - New export: `preloadGridField()`. It starts the one shared load and never rejects; a failed load is reported by the grid that needs it, through the nearest error boundary. - **`widgets/grid-field/GridFieldWidget.tsx`** is the body, moved from `widgets/GridField.tsx` (git reads it as a rename, R081). Only `loadGridFieldWidget`'s `import()` reaches it. - **The record forms wait for it.** - `MasterDetailForm` starts the load when it mounts. It draws a collection's grid only once the body has settled; until then it shows its existing "Loading columns…" copy. That holds on every path: derived columns, columns authored in full, and authored-but-untyped columns drawn while the derivation is in flight. - The record page's line-item editor (`RecordBodyTableEditor`) waits for the body together with the child schema. - `LineItemsPanel` starts the load when it mounts. - **Console chunking:** - `vite.config.ts` gains a `fields-grid` group (priority 82, ahead of `ui-components`). - `check-eager-closure-budget.mjs` gains its `PER_CHUNK_MEMBERSHIP_CARVE_OUTS` row (`src/widgets/grid-field` → `fields-grid`), following the `fields-date-picker` precedent (objectui#12622). - `vite-ineffective-dynamic-imports.ts` drops GridField from its defeated-lazy list, because the import is now effective. - **Budget:** the `ui-components` ceiling and its baseline come down by the bytes removed (below). The #36100 and #36109 entries no longer call this card a payback. - **Tests:** about 30 fields test files import the body by its new path (`GridFieldWidget as GridField`); the helpers stay on `./GridField`. Three plugin-form test files await `preloadGridField()` at module scope. ### The bytes (in the budget file's "Raising it" style) One container, one instrument: `CI=true pnpm exec turbo run build --filter=@object-ui/console...`, reading `apps/console/dist/eager-closure.json`, run twice on one tree. The first build is `main` at `b3bcfefc` alone; the second is the same `main` plus this change, at `3c422050`. Gzipped bytes: | chunk | `b3bcfefc` | `3c422050` | delta | |---|---:|---:|---:| | `vendor-objectstack` | 674,662 | 674,662 | 0 | | `i18n-locale-en` | 66,785 | 66,785 | 0 | | `framework` | 88,559 | 88,559 | 0 | | `ui-components` | 352,359 | 346,403 | −5,956 | | ⇒ aggregate | 1,875,902 | 1,869,974 | −5,928 | - The same 105 eager chunks appear by name in both builds. Total chunks go from 2,577 to 2,578; the new one is `fields-grid`, which is lazy (20,374 raw bytes). - Apart from `ui-components`, no chunk moved by more than 31 bytes (`index` +31). - Raw minified `ui-components`: 1,309,110 → 1,289,869 (−19,241). - Re-read on this PR's final head (`eb102830`, same instrument): `ui-components` is still 346,403, and the aggregate is 1,869,971 (−3 bytes against `3c422050`, spread over `index`, `src`, `relativeTime` and `useConsoleActionRuntime`). - An intermediate read at `4ca78ed1` (before the face became a JSX-free `.ts`) gave 346,399 (−5,960). The ceiling follows the final tree's −5,956. | constant | before | after | delta | |---|---:|---:|---:| | `PER_CHUNK_GZIP_CEILINGS['ui-components']` | 451,100 | 445,144 | −5,956 | | `PER_CHUNK_BASELINE['ui-components']` | 265,937 | 259,981 | −5,956 | The gap between ceiling and baseline is unchanged (185,163). ⛔ Not moved: `MAX_EAGER_CLOSURE_GZIP_BYTES`, `BASELINE`, `REGRESSION_THIS_GATE_MUST_CATCH_BYTES` and the other per-chunk rows. No exemption was added. `pnpm check:eager-closure` on the final build: `✅ chunk ui-components 338.3 KB measured / 434.7 KB ceiling`, plus the membership line `its src/widgets/grid-field subtree 1 in fields-grid, exactly`. ## Tests <details><summary>The first-open pin (live e2e, ui/e2e/live/master-detail.spec.ts)</summary> The new describe is "the line-item grid on a form's first open (objectstack#36102)". The spec is in the required `test:e2e:live:ci` lane. - An init script installs a `MutationObserver` before the document's first byte. It counts every attach of the placeholder (`grid-field-loading`) and of the grid (`line-items`). The grid count is the observer's control. - **Create:** the invoices list → New → the dialog's grid is visible → add a line → type `first-open` into the Description cell. The cell must still be focused after 300 ms and hold the text. Assertions: grid attaches > 0, placeholder attaches = 0. - **Edit:** `INV-1002`'s edit route. Its stored lines are drawn (Description not empty), then the same typing and the same counts. Local live stack: the workspace backend (`ui/e2e/live/ci/start-backend.sh`) and `vite preview` of a root-base console build, as the CI job runs them. - **Red first.** At `e581a9a5`, before `MasterDetailForm` gated the grid, the create case failed: `the grid never mounted on its loading placeholder: Expected: 0, Received: 1`. A trace showed the placeholder attached inside `md-collection` about 0.4 s before the grid, because the collection drew authored-but-untyped columns while the derivation was in flight. - **Then green.** At `51af8021`: `--repeat-each 3 --retries 0` → `15 passed (1.1m)` (the whole spec, 5 tests × 3). </details> <details><summary>Unit: the lazy face, and its ablation</summary> `GridField.test.tsx`, new describe "GridField — the lazy face the package exports (objectstack#36102)", using `vi.resetModules()` and a fresh import: - A mount before the body loads shows the placeholder, then the grid. A focused Description cell is still connected and still `document.activeElement` after a re-render. - After `await preloadGridField()`, `LineItemsField` renders with no placeholder. - `LineItemsField` is `GridField`, the same face. **Ablation** (committed first, through `node scripts/ablation-replace.mjs`): `const [loadedAtMount] = React.useState(() => gridFieldWidgetModule);` was replaced by `const loadedAtMount = gridFieldWidgetModule;`, so the decision is re-read on every render. - Anchor 1 → 0, blob `2e286b33ebdf → 1f484acf48d9`. - Result: `× a mount before the body loads shows the placeholder, then the grid, and a later render keeps the focused cell`, with `Tests 1 failed | 91 passed (92)`. - Restored: blob == HEAD (`2e286b33ebdf`) and `git diff HEAD` empty. </details> <details><summary>Suites</summary> - `pnpm exec vitest run packages/plugin-form/` (from `ui/`): `Test Files 244 passed (244)`, `Tests 2750 passed | 1 skipped`. - `pnpm exec vitest run packages/fields/ scripts/__tests__/check-eager-closure-budget.test.ts scripts/__tests__/vite-ineffective-dynamic-imports.test.ts scripts/__tests__/vite-declared-lazy-views.test.ts`: `Test Files 323 passed | 1 skipped (324)`, `Tests 5064 passed | 7 skipped`. - `pnpm --filter @object-ui/plugin-form run type-check` and `pnpm --filter @object-ui/fields run type-check`: both exit 0, after a rebuilt fields `dist`. - `pnpm --dir ui exec vitest run scripts/`: exit 0 (part of the derived gate list). </details> ## Acceptance notes - **Clause-② is `yes (widening)`, not the claim's `no`.** The new published export `preloadGridField()` widens `@object-ui/fields`'s surface; every existing export keeps its name and shape. It is needed so a host can have the grid's body in its first render, as the record forms do. - **On a cold first open, a master-detail collection shows "Loading columns…" until the child schema and the grid's body are both in.** The body load starts on mount and overlaps the schema fetch. A form that mounts after the body has settled draws its grid at first paint. - Before this PR, a collection with authored, untyped columns drew those columns at once and drew them again when the derivation landed. - **`LineItemsPanel` (the record page's read panel) starts the load but does not gate on it.** It draws its grid after its own fetches. The pin covers the create and edit forms the card names. - **Overlap:** two same-seat drafts conflict with the move of `widgets/GridField.tsx` to `widgets/grid-field/GridFieldWidget.tsx`. - #36351 conflicts in `GridField.lookupAutofill-28245.test.tsx` and the widget body. - #36392 conflicts in `GridField.test.tsx` and the widget body. - Whichever lands second re-applies its body hunks to `grid-field/GridFieldWidget.tsx`. The landing order is the seat's call. `origin/main` merges cleanly. - **Outside the claim's file surface:** `packages/spec/liveness/field.json`, whose evidence pointer moved to the helper's new file (`check:liveness` exit 0). - **Out of scope, for the seat to file (L1-d 7078535343):** `React.lazy` caches a first load failure for the whole session, so a host that renders `GridField` without `preloadGridField()` and hits one failed chunk load never recovers until a reload. - **Possible further carve-out, not done here:** `widgets/gridCellPanels.tsx` is imported only by the body and could follow it into `fields-grid` (about 2.5 KB gzip by estimate, not measured). ## Verification Read first, by risk: 1. `ui/packages/fields/src/widgets/GridField.ts`: the face, specifically `GridField`'s `useState(() => gridFieldWidgetModule)` and `loadGridFieldWidget`'s retry-on-failure. 2. `ui/packages/plugin-form/src/MasterDetailForm.tsx`: `useGridBodySettled` and the `!d.columns?.length || !gridBodyReady` arm. 3. `ui/scripts/check-eager-closure-budget.mjs`: the LOWERED entry, the baseline note and the carve-out row. Two-minute check: `cd ui && pnpm exec vitest run packages/fields/src/widgets/GridField.test.tsx`. Expect `Tests 92 passed (92)`, including the three cases of the "lazy face" describe. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ)_ <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 50d6da8 commit 0628e08

51 files changed

Lines changed: 858 additions & 421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@object-ui/fields': patch
3+
'@object-ui/plugin-form': patch
4+
'@object-ui/console': patch
5+
'@objectstack/spec': patch
6+
---
7+
8+
perf(fields): the line-item grid's body loads on first use, and the console's first load no longer carries it
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: none
12+
13+
The line-item grid (the `grid` field and the line items of a master-detail form) was the largest field widget in the console's first-load bytes, though only a form with line items draws it. Its body now loads the first time a grid is drawn, or earlier, when a form that draws line items mounts.
14+
15+
- **The same two components.** `GridField` and `LineItemsField` keep their names and their props. They now render the grid's body once it has loaded; a grid mounted before that shows a small busy placeholder until it arrives. A grid mounted after the body loaded renders it directly, and a grid that showed the placeholder draws the body once it arrives and never remounts it on a later render, so its rows and focused cell stay.
16+
- **One new export, `preloadGridField()`.** It starts loading the body ahead of the first grid. It is safe to call often, its promise settles once the body has loaded, and it never rejects: a failed load is reported by the grid that needs it, through the nearest error boundary.
17+
- **The record forms wait for it.** `MasterDetailForm` and the record page's line-item editor derive a grid's columns from the child object's schema, and now show those columns only once the body has loaded as well, so on a form's first open the grid never shows the placeholder. `LineItemsPanel` starts the load when it mounts.
18+
- **The helpers stay where they were.** `evalArith`, `computeRow`, `lookupAutofillPatch`, `columnHelpByField`, `UNTOUCHED_NEW_ROW`, `isUntouchedNewRow` and the `GridColumn`, `ColumnCurrencies` and `ColumnHelp` types are exported as before and load with the package.
19+
- **The console loads it on demand.** The console's build puts the grid's body in a chunk of its own (`fields-grid`), loaded on demand, so its first load is about 6 KB (gzip) smaller.
20+
- **The liveness ledger points at the helper's new file.** In `@objectstack/spec`, the evidence path for `lookupAutofill` in the field liveness ledger now names `widgets/GridField.ts`, where `lookupAutofillPatch` lives; the verdict does not change.
21+
22+
A host that renders `GridField` or `LineItemsField` itself and needs the grid in its first render calls `preloadGridField()` earlier and waits for it, as the record forms do. No metadata key, value or default changes.

‎packages/spec/liveness/field.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398
"status": "live",
399399
"verifiedAt": "2026-10-31",
400400
"evidenceScope": "in-repo",
401-
"evidence": "ui/packages/fields/src/widgets/lookupAutofill.ts#declaredLookupAutofillPatch (the one fill rule: each target from the picked record's source, filled only while empty or still holding the earlier pick's value unless `overwrite: true`); ui/packages/fields/src/widgets/LookupField.tsx#fillDeclaredTargets (the record form: every single-value pick path, popover, keyboard, quick-create and the browse-all dialog, reads the field's pairs and writes through the host's `onAutofill`); ui/packages/components/src/renderers/form/form.tsx#LOOKUP_AUTOFILL_WIDGET_TYPES (the form renderer hands a lookup its `onAutofill` writer, `form.setValue` as an edit); ui/packages/fields/src/widgets/GridField.tsx#lookupAutofillPatch (the line-item grid: the declared pair fills under the same rule and takes its target out of the same-named `autofill` copy), its pairs handed over by ui/packages/plugin-form/src/MasterDetailForm.tsx#lookupAutofill and ui/packages/plugin-form/src/LineItemsPanel.tsx#lineLookupAutofill through ui/packages/fields/src/widgets/lookupAutofill.ts#lookupAutofillByField; authoring doors unchanged: packages/spec/src/data/field.zod.ts#lookupAutofill, packages/spec/src/data/object.zod.ts#refuseDishonestLookupAutofill, packages/spec/src/stack.zod.ts#collectLookupAutofillErrors",
401+
"evidence": "ui/packages/fields/src/widgets/lookupAutofill.ts#declaredLookupAutofillPatch (the one fill rule: each target from the picked record's source, filled only while empty or still holding the earlier pick's value unless `overwrite: true`); ui/packages/fields/src/widgets/LookupField.tsx#fillDeclaredTargets (the record form: every single-value pick path, popover, keyboard, quick-create and the browse-all dialog, reads the field's pairs and writes through the host's `onAutofill`); ui/packages/components/src/renderers/form/form.tsx#LOOKUP_AUTOFILL_WIDGET_TYPES (the form renderer hands a lookup its `onAutofill` writer, `form.setValue` as an edit); ui/packages/fields/src/widgets/GridField.ts#lookupAutofillPatch (the line-item grid: the declared pair fills under the same rule and takes its target out of the same-named `autofill` copy), its pairs handed over by ui/packages/plugin-form/src/MasterDetailForm.tsx#lookupAutofill and ui/packages/plugin-form/src/LineItemsPanel.tsx#lineLookupAutofill through ui/packages/fields/src/widgets/lookupAutofill.ts#lookupAutofillByField; authoring doors unchanged: packages/spec/src/data/field.zod.ts#lookupAutofill, packages/spec/src/data/object.zod.ts#refuseDishonestLookupAutofill, packages/spec/src/stack.zod.ts#collectLookupAutofillErrors",
402402
"note": "LIVE — read by the record form and the line-item grid on a pick. Pinned end to end by ui/packages/plugin-form/src/ObjectForm.lookupAutofill-28245.test.tsx (an empty target fills and is saved, a typed value is kept, `overwrite: true` replaces, an earlier pick's value is replaced, the browse-all dialog fills too, a lookup without the key fills nothing) and ui/packages/fields/src/widgets/GridField.lookupAutofill-28245.test.tsx (the same rule in a grid row, the declared target out of the same-named copy, a stored line's own value kept). Bound: a master-detail collection whose relationship and every column are authored loads no child schema, so its grid fills only the same-named copy. PRODUCER: HotCRM's quote line item (product lookup, `unit_price` from the product's `list_price`).",
403403
"children": {
404404
"target": {

‎ui/apps/console/vite.config.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,30 @@ export default defineConfig({
15071507
priority: 82,
15081508
includeDependenciesRecursively: false,
15091509
},
1510+
//
1511+
// ## The line-item grid leaves the eager line (objectstack#36102)
1512+
//
1513+
// The same mechanism as the date picker above, one widget over. The
1514+
// grid's body is `packages/fields/src/widgets/grid-field/`, and
1515+
// nothing reaches it but `loadGridFieldWidget`'s `import()` in
1516+
// `widgets/GridField.ts`: the `GridField` / `LineItemsField` the
1517+
// package exports by name are the small lazy face in that file, so
1518+
// the entry's named export no longer makes the body a static
1519+
// dependency of the eager graph. Without this group `ui-components`
1520+
// would still claim the directory by path. Its pure helpers, which
1521+
// the entry also exports, stay in `ui-components`. The record forms
1522+
// that draw line items preload it on mount.
1523+
// `PER_CHUNK_MEMBERSHIP_CARVE_OUTS` in
1524+
// `scripts/check-eager-closure-budget.mjs` holds the split to the
1525+
// module, and errors if this chunk ever joins the eager closure.
1526+
// `includeDependenciesRecursively: false` for the reason given on
1527+
// `fields-date-picker`.
1528+
{
1529+
name: 'fields-grid',
1530+
test: /[\\/]packages[\\/]fields[\\/]src[\\/]widgets[\\/]grid-field[\\/]/,
1531+
priority: 82,
1532+
includeDependenciesRecursively: false,
1533+
},
15101534
{ name: 'ui-components', test: /[\\/]packages[\\/](components|fields)[\\/]/, priority: 80 },
15111535
{ name: 'ui-layout', test: /[\\/]packages[\\/]layout[\\/]/, priority: 80 },
15121536
{ name: 'infrastructure', test: /[\\/]packages[\\/](auth|permissions|tenant)[\\/]/, priority: 80 },

‎ui/e2e/live/master-detail.spec.ts‎

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect, type APIRequestContext, type Page, type Response } from '@playwright/test';
2-
import { selectOption, fillLookup } from './helpers';
2+
import { selectOption, fillLookup, addLineItem } from './helpers';
33

44
/**
55
* Live e2e for the master-detail entry form (showcase "New Project + Tasks").
@@ -145,3 +145,90 @@ test('Create with a task line stores the child referencing the parent', async ({
145145
expect(child?.title).toBe('E2E Task A');
146146
expect(child?.project).toBe(parentId);
147147
});
148+
149+
/**
150+
* objectstack#36102 — the line-item grid's body left the console's eager chunk:
151+
* `@object-ui/fields` exports a lazy face whose body loads through one
152+
* `import()`, which the record forms start when they mount and wait for with
153+
* the child schema they derive the columns from. On a form's FIRST open the
154+
* grid must therefore mount on its body, never on its loading placeholder
155+
* (`grid-field-loading`), and a cell the user is typing in must keep focus.
156+
*
157+
* The observer is installed before the document's first byte, so it sees every
158+
* attach of the placeholder, however brief. Its control is the grid itself: the
159+
* same observer must have seen `line-items` attach, or a zero count would only
160+
* say the observer saw nothing.
161+
*/
162+
test.describe('the line-item grid on a form\'s first open (objectstack#36102)', () => {
163+
const INVOICES = '/apps/showcase_app/showcase_invoice';
164+
165+
/** Count every attach of the placeholder and of the grid, from document start. */
166+
async function watchGridMounts(page: Page) {
167+
await page.addInitScript(() => {
168+
const seen = { placeholder: 0, grid: 0 };
169+
(window as unknown as { __gridMounts: typeof seen }).__gridMounts = seen;
170+
const count = (node: Node) => {
171+
if (!(node instanceof Element)) return;
172+
seen.placeholder += node.matches('[data-testid="grid-field-loading"]') ? 1 : 0;
173+
seen.placeholder += node.querySelectorAll('[data-testid="grid-field-loading"]').length;
174+
seen.grid += node.matches('[data-testid="line-items"]') ? 1 : 0;
175+
seen.grid += node.querySelectorAll('[data-testid="line-items"]').length;
176+
};
177+
new MutationObserver((records) => {
178+
for (const record of records) record.addedNodes.forEach(count);
179+
}).observe(document, { childList: true, subtree: true });
180+
});
181+
}
182+
183+
const gridMounts = (page: Page) =>
184+
page.evaluate(() => (window as unknown as { __gridMounts: { placeholder: number; grid: number } }).__gridMounts);
185+
186+
/** Type into the first Description cell and check the cell kept focus and the text. */
187+
async function typeKeepsFocus(page: Page, scope: ReturnType<Page['getByTestId']>) {
188+
const cell = scope.locator('input[aria-label="Description"]').first();
189+
await cell.click();
190+
// A stored line already has text: type at its end, not where the click landed.
191+
await cell.press('End');
192+
await cell.pressSequentially('first-open');
193+
// A beat for any late remount to land before it is checked.
194+
await page.waitForTimeout(300);
195+
await expect(cell).toBeFocused();
196+
await expect(cell).toHaveValue(/first-open$/);
197+
}
198+
199+
test('the New Invoice form draws its line grid on its body, and a typed cell keeps focus', async ({ page }) => {
200+
await watchGridMounts(page);
201+
await page.goto(INVOICES);
202+
await page.getByTestId('object-view-new-button').first().click();
203+
const dialog = page.getByRole('dialog');
204+
const grid = dialog.getByTestId('line-items');
205+
await expect(grid).toBeVisible();
206+
207+
await addLineItem(page);
208+
await typeKeepsFocus(page, grid);
209+
210+
const mounts = await gridMounts(page);
211+
expect(mounts.grid, 'the observer saw the grid attach (its control)').toBeGreaterThan(0);
212+
expect(mounts.placeholder, 'the grid never mounted on its loading placeholder').toBe(0);
213+
});
214+
215+
test('an invoice edit form draws its stored lines on the body, and a typed cell keeps focus', async ({ page, request }) => {
216+
const res = await request.get(`${API}/api/v1/data/showcase_invoice?$top=50`);
217+
expect(res.ok(), `GET showcase_invoice answered ${res.status()}`).toBe(true);
218+
const body = await res.json();
219+
const invoice = (body?.records ?? body?.data ?? []).find((r: { name?: string }) => r.name === 'INV-1002');
220+
expect(invoice, 'the seeded draft invoice INV-1002 exists').toBeTruthy();
221+
222+
await watchGridMounts(page);
223+
await page.goto(`${INVOICES}/record/${encodeURIComponent(invoice.id ?? invoice._id)}/edit`);
224+
const grid = page.getByTestId('line-items');
225+
await expect(grid).toBeVisible();
226+
await expect(grid.locator('input[aria-label="Description"]').first()).not.toHaveValue('');
227+
228+
await typeKeepsFocus(page, grid);
229+
230+
const mounts = await gridMounts(page);
231+
expect(mounts.grid, 'the observer saw the grid attach (its control)').toBeGreaterThan(0);
232+
expect(mounts.placeholder, 'the grid never mounted on its loading placeholder').toBe(0);
233+
});
234+
});

‎ui/packages/fields/src/__tests__/date-carrier-unparsable-8809.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { formatDate } from '@object-ui/core';
5858
import { I18nProvider, LocalizationProvider } from '@object-ui/i18n';
5959
import { DateField } from '../widgets/DateField';
6060
import { FormulaField } from '../widgets/FormulaField';
61-
import { GridField } from '../widgets/GridField';
61+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
6262
import { renderLookupColumnValue } from '../widgets/lookupColumnDisplay';
6363

6464
afterEach(cleanup);

‎ui/packages/fields/src/__tests__/date-locale-channel.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import { DateCellRenderer, DateTimeCellRenderer } from '../index';
7272
import { DateField } from '../widgets/DateField';
7373
import { DateTimeField } from '../widgets/DateTimeField';
7474
import { FormulaField } from '../widgets/FormulaField';
75-
import { GridField } from '../widgets/GridField';
75+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
7676

7777
/**
7878
* `n` days from today, pinned to local noon so a run that starts near

‎ui/packages/fields/src/__tests__/datetime-widget-faces-8209.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import '@testing-library/jest-dom';
5858
import { formatDateTime } from '@object-ui/core';
5959
import { I18nProvider, LocalizationProvider } from '@object-ui/i18n';
6060
import { DateTimeField } from '../widgets/DateTimeField';
61-
import { GridField } from '../widgets/GridField';
61+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
6262

6363
/** The five locales this change was measured in (objectui#8194's set). */
6464
const LOCALES = ['en', 'de', 'zh', 'ja', 'ar'] as const;

‎ui/packages/fields/src/__tests__/display-grid-host-channels-e2e.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { FormulaField } from '../widgets/FormulaField';
6262
import { SummaryField } from '../widgets/SummaryField';
6363
import { AutoNumberField } from '../widgets/AutoNumberField';
6464
import { VectorField } from '../widgets/VectorField';
65-
import { GridField } from '../widgets/GridField';
65+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
6666
import { TextField } from '../widgets/TextField';
6767

6868
const DISPLAY_TYPES = ['formula', 'summary', 'auto_number', 'vector'] as const;

‎ui/packages/fields/src/__tests__/fields-date-widget-convention-8194.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
* That yields SIX bare no-bag sites, two more than the card's four:
2424
*
2525
* 1. `widgets/DateField.tsx` readonly `date` widget ← fixed
26-
* 2. `widgets/GridField.tsx` sub-grid `date` column ← fixed
26+
* 2. `widgets/grid-field/GridFieldWidget.tsx` sub-grid `date` column ← fixed
2727
* 3. `widgets/FormulaField.tsx` `returnType: 'date'` ← fixed
2828
* 4. `widgets/lookupColumnDisplay.tsx` the `$date` fallback ← fixed
2929
* 5. `widgets/DateField`'s sibling `DateTimeField.tsx` readonly ← NOT
30-
* 6. `widgets/GridField.tsx`'s `datetime`/`time` branch ← NOT
30+
* 6. `widgets/grid-field/GridFieldWidget.tsx`'s `datetime`/`time` branch ← NOT
3131
*
3232
* 5 and 6 are DATETIME faces. Their one home is `formatDateTime`, which has
3333
* its own face vocabulary (`'compact'` from objectui#7443 versus the verbose
@@ -83,7 +83,7 @@ import { I18nProvider, LocalizationProvider } from '@object-ui/i18n';
8383
import { DateField } from '../widgets/DateField';
8484
import { DateTimeField } from '../widgets/DateTimeField';
8585
import { FormulaField } from '../widgets/FormulaField';
86-
import { GridField } from '../widgets/GridField';
86+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
8787
import { renderLookupColumnValue } from '../widgets/lookupColumnDisplay';
8888

8989
/** The five locales this change was measured in. */

‎ui/packages/fields/src/__tests__/parentCurrency.faces-31912.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import '@object-ui/components';
2626
import { FormulaCellRenderer, withFollowedParentObject } from '../index';
2727
import { CurrencyField } from '../widgets/CurrencyField';
2828
import { SummaryField } from '../widgets/SummaryField';
29-
import { GridField } from '../widgets/GridField';
29+
import { GridFieldWidget as GridField } from '../widgets/grid-field/GridFieldWidget';
3030
import { TextField } from '../widgets/TextField';
3131

3232
afterEach(cleanup);

0 commit comments

Comments
 (0)