Repository navigation
refactor(plugin-grid): move ObjectGrid's query inputs and grouping decisions into sibling hooks (slice 4) - #26499
Merged
Conversation
…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
Contributor
Author
席位核对 · ACCEPT · seat
|
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(mainwith slice 3).ui/packages/plugin-grid/src/ObjectGrid.tsxis 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:d0a7e748schemaFields/schemaColumns, concurrency token, row colour field, grouping and predicate projection keysuseObjectGridQueryInputsinobjectGridQueryInputs.tsschemaplus three inputs)serverGroupedFetch, the two grouping refusals, the fetch window and the heldgroupRowQueryuseObjectGridGroupingDecisionsinobjectGridGroupingDecisions.tsThe 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
anyis introduced:useObjectGridQueryInputs({ schema, objectName, externalManualPagination, hostSearch }), withhostSearch: ObjectGridExternalPaginationProps['search'].useObjectGridGroupingDecisions({ schema, objectName, objectFields, objectTypesPending, perms, dataSource, hasInlineData, dataConfig, externalManualPagination, hostRowCount, serverPageSize }), withperms: ReturnType<typeof usePermissions>,hostRowCount: ObjectGridExternalPaginationProps['rowCount'],dataConfig: ViewData | { provider: string; items: unknown[] } | null(the type thedataConfigmemo infers, withany[]read asunknown[]), andobjectFields: 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.tsxgoes from 6571 to 6307 lines. The diff is 820 changed lines.Move-only proof: the multiset of non-blank lines of the base
ObjectGrid.tsxequals the newObjectGrid.tsxplus 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 tworeturn { … }lists, and inObjectGrid.tsxthe two imports plus the two calls with their two-line comments and destructuring lists.Open PRs on
ObjectGrid.tsxNone. I checked all 17 open PRs at the claim (05:00Z): none touches
ObjectGrid.tsxor itsobjectGrid*siblings. The version-packages PR #25640 touches only the plugin-gridCHANGELOG.mdandpackage.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, andgridArrayArmOrderby-8973'sparams.$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):
findParamssync (adjacent), into one hook with every input typed from its source.gridArrayArmOrderby-8973pins one$orderbyline in K besideexport function parseSchemaSort, which stays; the slice has that test read the new module as well (a path edit).gridNonAuthorKeys'columnStatereads (path-only).generateColumns, column post-processing and the actions column, re-pointing the fivegenerateColumnspins path-only.The regions after the early returns (S, T, W–AG) and G stay in
ObjectGrid.tsxunless 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 onb871ab8f).pnpm --filter @object-ui/plugin-grid type-checkexit 0 (after rebuilding@object-ui/plugin-grid^...so no dependency dist is stale).turbo run build --filter=@object-ui/console: 70 of 70 tasks.react-hooks/exhaustive-depsmessages inObjectGrid.tsxnow also namesetGroupRowQueryandsetServerPage, because a setter returned from a custom hook is not known to be stable; oneset-state-in-effectwarning 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;--ranreconciles 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 wholescripts/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