Skip to content

refactor(plugin-grid): move ObjectGrid's query inputs and grouping decisions into sibling hooks (slice 4) - #26499

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-mbvzks
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-mbvzks

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Part of #25994 (slice 4 of the move-only split; slices 1–3 landed as #26323, #26354 and #26364, and the card stays open for the slices listed below).

Clause-②: no
Metadata-protocol: none

What moved

Base d0a7e748 (main with slice 3). ui/packages/plugin-grid/src/ObjectGrid.tsx is 6571 lines there. Following the seat's grouping ruling (2–3 adjacent concerns per PR), this slice moves concerns H, I and J of the seam table in #26364. They are adjacent in the component body, all above the first early return, so each becomes a custom hook called where its lines stood:

# Concern Lines on d0a7e748 New home
H Projection keys: schemaFields/schemaColumns, concurrency token, row colour field, grouping and predicate projection keys 1175–1233 useObjectGridQueryInputs in objectGridQueryInputs.ts
I The view's filter (lowered once, refusal kept), sort, search and server-paging state 1234–1327 the same hook (H and I are one run of lines, both read only schema plus three inputs)
J Grouping decisions: the masked grouping-key refusal and its warning, serverGroupedFetch, the two grouping refusals, the fetch window and the held groupRowQuery 1376–1540 useObjectGridGroupingDecisions in objectGridGroupingDecisions.ts

The two inline-data effects between I and J (lines 1329–1374) stay in ObjectGrid.tsx. They belong to the record source (F), which stays in the component, and the hooks are called around them, so the component's hook order does not change.

Hook inputs are passed explicitly and typed from their source; no context is added and no any is introduced:

  • useObjectGridQueryInputs({ schema, objectName, externalManualPagination, hostSearch }), with hostSearch: ObjectGridExternalPaginationProps['search'].
  • useObjectGridGroupingDecisions({ schema, objectName, objectFields, objectTypesPending, perms, dataSource, hasInlineData, dataConfig, externalManualPagination, hostRowCount, serverPageSize }), with perms: ReturnType<typeof usePermissions>, hostRowCount: ObjectGridExternalPaginationProps['rowCount'], dataConfig: ViewData | { provider: string; items: unknown[] } | null (the type the dataConfig memo infers, with any[] read as unknown[]), and objectFields: Readonly<Record<string, { type?: unknown } | undefined>> | undefined (the hook reads only .type).

Each hook returns exactly the names the rest of the component reads (23 and 9), and the component destructures them under the same names. No identifier is renamed. Nothing new is exported from ObjectGrid.tsx, and the package entry is untouched. Five import specifiers move with their only readers (useFilterScope, toFilterNodeSafely, useResolvedGridFilters, NO_GROUPING_REFUSAL, DEFAULT_FETCH_BATCH_SIZE). ObjectGrid.tsx goes from 6571 to 6307 lines. The diff is 820 changed lines.

Move-only proof: the multiset of non-blank lines of the base ObjectGrid.tsx equals the new ObjectGrid.tsx plus the two modules. Nothing is missing except the 4 edited import lines, which differ only by the removed specifiers. The only added lines are the two module headers, their imports, the hook signatures, the two return { … } lists, and in ObjectGrid.tsx the two imports plus the two calls with their two-line comments and destructuring lists.

Open PRs on ObjectGrid.tsx

None. I checked all 17 open PRs at the claim (05:00Z): none touches ObjectGrid.tsx or its objectGrid* siblings. The version-packages PR #25640 touches only the plugin-grid CHANGELOG.md and package.json.

Source pins

No test reads the moved lines as source. I grepped every file that reads ObjectGrid.tsx (the plugin-grid __tests__ source scans, the census tests elsewhere, ui/scripts/__tests__) for each moved name. The only hits are in prose, and gridArrayArmOrderby-8973's params.$orderby = headerSort… pin, which is in the load effect (K) and stays. gridNonAuthorKeys' NON-AUTHOR SURFACE — \key`anchors are not in H–J (therowActionDefsRaw` comment names the exemption without that anchor). No census row is re-keyed in this slice.

Test edits

None.

Seam table update, and the remaining slices

The table in #26364 still holds, shifted: on this branch H, I and J are gone, and every later region starts about 264 lines earlier. The plan below follows the seat's ruling (2–3 adjacent concerns per PR, census pins may be re-pointed path-only):

  • Slice 5 — K + L: the row load effect and the host findParams sync (adjacent), into one hook with every input typed from its source. gridArrayArmOrderby-8973 pins one $orderby line in K beside export function parseSchemaSort, which stays; the slice has that test read the new module as well (a path edit).
  • Slice 6 — N + O + P: group value formatter and temporal group faces, server grouping, bulk fan-out params and column summaries (adjacent; fix(fields,plugin-grid): a grid date column reads in one absolute face #26341 has landed, so N is free).
  • Slice 7 — C + D + E: row-height sync, column-state persistence and pull-to-refresh with the card-view breakpoint (adjacent, at the top of the body). D re-points gridNonAuthorKeys' columnState reads (path-only).
  • Slice 8 — R + U + V (closes the card): generateColumns, column post-processing and the actions column, re-pointing the five generateColumns pins path-only.

The regions after the early returns (S, T, W–AG) and G stay in ObjectGrid.tsx unless the seat wants further slices.

Verification

Run on 09fc0d22 (this head):

  • pnpm --dir ui exec vitest run packages/plugin-grid/ --maxWorkers=2, the whole package suite, under the verification lock: 253 of 253 files, 2256 of 2256 tests. The before reading is the same count on slice 3 (refactor(plugin-grid): move ObjectGrid's authored-input diagnostics into a sibling hook (slice 3) #26364, CI green on b871ab8f).
  • The 52 test files outside plugin-grid that read sources (the list slices 1–3 used): 52 of 52 files, 2258 of 2258 tests.
  • pnpm --filter @object-ui/plugin-grid type-check exit 0 (after rebuilding @object-ui/plugin-grid^... so no dependency dist is stale).
  • turbo run build --filter=@object-ui/console: 70 of 70 tasks.
  • eslint on the three files: 0 errors, and 226 warnings before and after. The modules draw only warnings the moved lines already drew. Two react-hooks/exhaustive-deps messages in ObjectGrid.tsx now also name setGroupRowQuery and setServerPage, because a setter returned from a custom hook is not known to be stable; one set-state-in-effect warning is no longer raised for the same reason. No dependency array changed.
  • node scripts/pm/dispatch-gates.mjs --commands: 29 derived gates, all exit 0; --ran reconciles 29 of 29 (0 NOT-MEASURED, 0 UNRUN). pnpm --dir ui exec vitest run scripts/ first hit two 15 s timeouts (check-i18n-dead-keys, js-comment-mask-returns-interpolation-9424) while the locked suite was running beside it; both files passed alone, and the whole scripts/ run then passed under the lock (178 files, 5097 tests).

Landing

No other open PR touches ObjectGrid.tsx, so this can land as soon as CI is green.

Changeset: .changeset/25994-objectgrid-query-grouping-hooks.md (patch, @object-ui/plugin-grid).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bdrd2yH4eqnz2QobtN3haE

…cisions into sibling hooks (slice 4)

Two adjacent blocks of the component body move verbatim: the projection
keys plus the filter, sort, search and server-paging state into
useObjectGridQueryInputs, and the grouping decisions (masked-key refusal,
server grouping, the two refusals, fetch window, group row query) into
useObjectGridGroupingDecisions. Each hook is called where its block
stood, so hook order is unchanged. The two inline-data effects between
them stay in ObjectGrid.tsx.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bdrd2yH4eqnz2QobtN3haE
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling labels Oct 27, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · ACCEPT · seat domain:ui#1 · 2026-10-27T05:50Z · #25994 slice 4

Head 09fc0d22 (read from the PR object). Base main d0a7e748.

  • Shape. 4 files, +498 / −322. H and I (projection keys, plus filter, sort, search and server-paging state) move into useObjectGridQueryInputs in objectGridQueryInputs.ts. J (grouping decisions) moves into useObjectGridGroupingDecisions in objectGridGroupingDecisions.ts. The inline-data effects between them stay where they are, so hook order is unchanged. ObjectGrid.tsx goes from 6571 to 6307 lines. Root changeset included. Part of [maintainer] refactor(ui): split ObjectGrid.tsx (7641 lines) into smaller modules, one move-only slice per PR, so concurrent ui cards stop colliding in it #25994.
  • Move-only, re-measured by the seat. The multiset of non-blank lines of the base ObjectGrid.tsx is contained in the new ObjectGrid.tsx plus the two modules, except 4 import lines that lost moved names. Each one reappears in its trimmed form. There are no test edits and no census re-key.
  • Governed surface. scripts/pm/check-governed-merges.mjs --pr 26499: not governed.
  • Checks pinned to the head. All check runs completed: 0 failing, 0 pending. The seat's landing script checked this before posting.
  • Evidence (dev). plugin-grid passes 253/253 files and 2256/2256 tests, and the 52 outside readers pass 52/52. Type-check exits 0. The Console build passes 70/70. eslint shows 0 errors with warnings unchanged at 226. dispatch gates: 29/29.
  • Serial constraints. None. No other open PR touches ObjectGrid.tsx; chore: version packages #25640 touches only plugin-grid's CHANGELOG and package.json. The slices are held one at a time, and slice 5 (K+L) starts from main after this PR merges.

Landing: ready + auto-merge through the relay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants