Repository navigation
refactor(plugin-grid): move ObjectGrid's row load into a sibling hook (slice 5) - #26537
Merged
Merged
Conversation
… (slice 5) The invalidation nonce, the async load effect, the host findParams reset and the page-1 reset move verbatim into useObjectGridRowLoad, called where the block stood, so hook order is unchanged. toOrderByClause moves with its only caller. gridArrayArmOrderby-8973 reads ObjectGrid.tsx and the new module joined, since its $orderby pin moved while parseSchemaSort stays. 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 5 of the move-only split; slices 1–4 landed as #26323, #26354, #26364 and #26499, and the card stays open for the slices listed below).
Clause-②: no
Metadata-protocol: none
What moved
Base
14f30991(mainwith slice 4).ui/packages/plugin-grid/src/ObjectGrid.tsxis 6307 lines there. This slice moves concerns K and L of the seam table in #26364, as re-planned in #26499. They are adjacent and above the first early return, so they become one custom hook,useObjectGridRowLoad, in the new siblingui/packages/plugin-grid/src/objectGridRowLoad.ts, called where the lines stood:14f30991invalidationNonce) and the unified async load effect: object definition, then rows, totals,lastFindParamsRefand the server-grouped row queryfindParamsreset of "select all matching" (hostFindParamsKey) and the page-1 reset when the query changestoOrderByClausewith its docblock (module level)toOrderByClausemoves with the load effect because that effect is its only caller (slice 2 left it beside its call sites for that reason; the call sites now live in the new module).parseSchemaSortstays inObjectGrid.tsx, pinned bygridArrayArmOrderby-8973. Its docblock's{@link toOrderByClause}now names a function in the sibling module; the sentence is unchanged.The hook takes 35 inputs, passed explicitly and typed from their source; no context is added and no
anyis introduced:ReturnType<typeof useObjectGridQueryInputs>[name]andReturnType<typeof useObjectGridGroupingDecisions>[name].schema: ObjectGridSchema,dataSource: DataSource | undefined,objectName: string | undefined,dataConfig: ViewData | { provider: string; items: unknown[] } | null,hasInlineData: boolean,perms: ReturnType<typeof usePermissions>,refreshKey: number,hostFindParams: ObjectGridExternalPaginationProps['findParams'],lastFindParamsRef: React.RefObject<Record<string, unknown> | null>, and the six setters asReact.Dispatch<React.SetStateAction<…>>of their state's type.dataandobjectSchemaareuseState<any…>in the component, so their setters are typed withunknown[]andunknownin the hook, and the effect type-checks against that unchanged.The hook returns
{ invalidationNonce }, the one name the rest of the component reads (groupReloadKey). No identifier is renamed. Nothing new is exported fromObjectGrid.tsx, and the package entry is untouched. Twelve import specifiers and thefindParamsSignatureimport move with their only readers.ObjectGrid.tsxgoes from 6307 to 5639 lines. The diff is 1464 changed lines.Move-only proof: the multiset of non-blank lines of the base
ObjectGrid.tsxequals the newObjectGrid.tsxplusobjectGridRowLoad.ts. Nothing is missing except the 4 edited import lines, which differ only by the removed specifiers. The only added lines are the module header and imports, the twoReturnTypealiases, the hook signature,return { invalidationNonce };, and inObjectGrid.tsxthe import plus the call with its two-line comment.Open PRs on
ObjectGrid.tsxNone. I checked all 22 open PRs at the claim (06:15Z): none touches
ObjectGrid.tsx, itsobjectGrid*siblings orgridArrayArmOrderby-8973.test.tsx.Test edits
One, a path edit, as the seat ruled.
gridArrayArmOrderby-8973.test.tsxpinsparams.$orderby = headerSort.map(…)in the load effect, now inobjectGridRowLoad.ts, andexport function parseSchemaSort, which stays. Its source probe now reads the two files joined:Every assertion is unchanged. No other test reads the moved lines as source: I matched every string literal of every source-reading test against the moved lines, and the only other hits were prose in test comments.
column-identity.ratchetstill finds itscolumnIdentity(call inObjectGrid.tsx(line 1859 there).Remaining slices
As re-planned in #26499: 6 — N + O + P (group value formatter and temporal faces, server grouping, bulk fan-out and column summaries), 7 — C + D + E (row-height sync, column-state persistence, pull to refresh; re-points
gridNonAuthorKeys'columnStatereads), 8 — R + U + V (closes the card; re-points the fivegenerateColumnspins).Verification
Run on
5345a340(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 4 (refactor(plugin-grid): move ObjectGrid's query inputs and grouping decisions into sibling hooks (slice 4) #26499, CI green on09fc0d22).pnpm --filter @object-ui/plugin-grid type-checkexit 0.turbo run build --filter=@object-ui/console: 70 of 70 tasks.react-hooks/exhaustive-depsmessages name different variables (the load effect's now listslastFindParamsRef,setData,setError… instead ofsetGroupRowQuery; thefindParamsreset's now namessetSelectAllMatching), and oneset-state-in-effectwarning is no longer raised. No dependency array changed.node scripts/pm/dispatch-gates.mjs --commands: 35 derived gates, all exit 0 (thevitest run scripts/gate ran under the lock: 178 files, 5097 tests);--ranreconciles 35 of 35 (0 NOT-MEASURED, 0 UNRUN).Landing
No other open PR touches these files, so this can land as soon as CI is green.
Changeset:
.changeset/25994-objectgrid-row-load-hook.md(patch,@object-ui/plugin-grid).🤖 Generated with Claude Code
https://claude.ai/code/session_01Bdrd2yH4eqnz2QobtN3haE