Skip to content

refactor(plugin-grid): move ObjectGrid's row load into a sibling hook (slice 5) - #26537

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 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 (main with slice 4). ui/packages/plugin-grid/src/ObjectGrid.tsx is 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 sibling ui/packages/plugin-grid/src/objectGridRowLoad.ts, called where the lines stood:

# Concern Lines on 14f30991
K The data-invalidation nonce (invalidationNonce) and the unified async load effect: object definition, then rows, totals, lastFindParamsRef and the server-grouped row query 1278–1894
L The host findParams reset of "select all matching" (hostFindParamsKey) and the page-1 reset when the query changes 1896–1923
— toOrderByClause with its docblock (module level) 104–134

toOrderByClause moves 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). parseSchemaSort stays in ObjectGrid.tsx, pinned by gridArrayArmOrderby-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 any is introduced:

  • The values from slice 4's hooks are typed as ReturnType<typeof useObjectGridQueryInputs>[name] and ReturnType<typeof useObjectGridGroupingDecisions>[name].
  • The rest: 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 as React.Dispatch<React.SetStateAction<…>> of their state's type. data and objectSchema are useState<any…> in the component, so their setters are typed with unknown[] and unknown in 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 from ObjectGrid.tsx, and the package entry is untouched. Twelve import specifiers and the findParamsSignature import move with their only readers. ObjectGrid.tsx goes from 6307 to 5639 lines. The diff is 1464 changed lines.

Move-only proof: the multiset of non-blank lines of the base ObjectGrid.tsx equals the new ObjectGrid.tsx plus objectGridRowLoad.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 two ReturnType aliases, the hook signature, return { invalidationNonce };, and in ObjectGrid.tsx the import plus the call with its two-line comment.

Open PRs on ObjectGrid.tsx

None. I checked all 22 open PRs at the claim (06:15Z): none touches ObjectGrid.tsx, its objectGrid* siblings or gridArrayArmOrderby-8973.test.tsx.

Test edits

One, a path edit, as the seat ruled. gridArrayArmOrderby-8973.test.tsx pins params.$orderby = headerSort.map(…) in the load effect, now in objectGridRowLoad.ts, and export function parseSchemaSort, which stays. Its source probe now reads the two files joined:

-    const src = readFileSync(join(REPO_ROOT, 'packages/plugin-grid/src/ObjectGrid.tsx'), 'utf8');
+    const src = ['ObjectGrid.tsx', 'objectGridRowLoad.ts']
+      .map((file) => readFileSync(join(REPO_ROOT, 'packages/plugin-grid/src', file), 'utf8'))
+      .join('\n');

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.ratchet still finds its columnIdentity( call in ObjectGrid.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' columnState reads), 8 — R + U + V (closes the card; re-points the five generateColumns pins).

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 on 09fc0d22).
  • The 52 test files outside plugin-grid that read sources (the list slices 1–4 used): 52 of 52 files, 2258 of 2258 tests.
  • pnpm --filter @object-ui/plugin-grid type-check exit 0.
  • turbo run build --filter=@object-ui/console: 70 of 70 tasks.
  • eslint on the three touched files: 0 errors, and 229 warnings before and after. As in slice 4, the setters now come from the hook's parameters, so two react-hooks/exhaustive-deps messages name different variables (the load effect's now lists lastFindParamsRef, setData, setError… instead of setGroupRowQuery; the findParams reset's now names setSelectAllMatching), and one set-state-in-effect warning is no longer raised. No dependency array changed.
  • node scripts/pm/dispatch-gates.mjs --commands: 35 derived gates, all exit 0 (the vitest run scripts/ gate ran under the lock: 178 files, 5097 tests); --ran reconciles 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

… (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
@github-actions github-actions Bot added size/xl 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-27T07:24Z · #25994 slice 5

Head 5345a340 (read from the PR object). Base main 14f30991. Part of #25994.

  • Shape. 4 files, +780 / −684. K (the invalidation nonce and the async load effect) and L (the findParams select-all reset and the page-1 reset) move into useObjectGridRowLoad in objectGridRowLoad.ts. The hook is called where the code stood, so hook order is unchanged. toOrderByClause moves with its only caller, and parseSchemaSort stays in ObjectGrid.tsx. ObjectGrid.tsx goes from 6307 to 5639 lines. Root changeset included.
  • 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 module, except 4 import lines that lost moved names. Each one reappears in its trimmed form.
  • Test edit, re-read by the seat. gridArrayArmOrderby-8973 now reads ObjectGrid.tsx and the module joined. It is a file-list change only, and its assertions are unchanged, as slice-4 rulings allow.
  • Governed surface. scripts/pm/check-governed-merges.mjs --pr 26537: 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 outside readers pass 52/52. Type-check exits 0. The Console build passes 70/70. eslint shows 0 errors, with warnings at 229 before and after. Gates: 35/35.
  • Serial constraints. None. No other open PR touches these files. Slice 6 (N+O+P) 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/xl tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants