Repository navigation
refactor(plugin-grid): move ObjectGrid's column generator, column post-processing and Actions column into sibling modules (slice 8) - #26806
Merged
Conversation
…t-processing and Actions column into sibling modules Slice 8 of the move-only ObjectGrid split: regions R, U and V move verbatim into useObjectGridGenerateColumns, resolveObjectGridPersistedColumns and resolveObjectGridActionsColumn, called where the lines stood. Five source pins re-point their path to the new modules. Claude-Session: https://claude.ai/code/session_01JQwxbXqCPeUA7ztE9YWKwP Co-authored-by: Claude <noreply@anthropic.com>
…ectGrid.tsx no longer reads Claude-Session: https://claude.ai/code/session_01JQwxbXqCPeUA7ztE9YWKwP Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
维护者速读
席位核对ACCEPT · seat
Generated by Claude Code |
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 Warren · project thread
Fixes #25994 (slice 8, the last slice of the move-only split: regions R, U and V. Slices 1 to 7 have landed; this one closes the card.)
Clause-②: no
Metadata-protocol: none
维护者速读
ObjectGrid.tsx里最后三大块代码(列生成回调generateColumns、列后处理与持久化列宽列序、操作列与固定列集合)原样搬进三个同目录模块,组件在原位置调用它们;文件从 5160 行降到 3962 行(拆分前 7689 行)。ObjectGrid.tsx(7641 lines) into smaller modules, one move-only slice per PR, so concurrent ui cards stop colliding in it #25994。objectGridGenerateColumns.tsx的签名与依赖数组(与原useCallback相同)、ObjectGrid.tsx里三处调用、五个测试文件的路径改动。pnpm --dir ui exec vitest run packages/plugin-grid/ --maxWorkers=2,预期 253 个文件、2256 个测试全绿,与 main 相同。ObjectGrid.tsx(7641 lines) into smaller modules, one move-only slice per PR, so concurrent ui cards stop colliding in it #25994。What changes
Base
7bdff7ec(origin/main).ui/packages/plugin-grid/src/ObjectGrid.tsxis 5160 lines there. This slice moves regions R, U and V of the seam table in #26364 (re-planned in #26499), the last three blocks the card names, verbatim into three new sibling modules:generateColumns, theuseCallbackthat turns the authored columns, or the object's fields, into column drafts (base lines 1221 to 2098)useObjectGridGenerateColumnsinobjectGridGenerateColumns.tsxschema,dataSource,data,dataConfig,hasInlineData,objectName,objectSchema,objectFields,objectTypesPending,schemaFields,schemaColumns,perms,navigation,executeAction,predicateScope,resolveFieldLabel,translateOptions,uiLanguagegenerateColumnsresolveObjectGridPersistedColumnsinobjectGridPersistedColumns.tsgenerateColumns,objectFields,objectName,perms,objectTypesPending,columnStatepersistedColumnsmaxInlineRowActions, and the pinned column sets (base lines 2559 to 2719)resolveObjectGridActionsColumninobjectGridActionsColumn.tsxschematot(listed in the module signature)columnsWithActions,hasActions,hasPinnedColumns,hasUserPinnedColumns,pinnedLeftCols,pinnedRightCols,unpinnedCols,rightPinnedClasses,rightPinnedCellClasses,userLeftPinnedCountuseCallbackwith the same dependency array, called where the callback stood, so the component's hook order does not change. U and V stand below the component's early returns, so they are plain functions, as on slices 5 to 7.ReturnTypeof the hook or helper that produces them (usePermissions,useNavigationOverlay,useAction,usePredicateScope,useSafeFieldLabel,useGridTranslation,useObjectGridQueryInputs,useObjectGridColumnState,useCapabilityGate,useRecordCrudVerdicts,resolveLegacyRowActions,resolveRowCrudAffordances),ObjectGridComponentPropsfor the host callbacks, and React'sDispatchofSetStateActionforsetRefreshKey. No context.ObjectGrid.tsxand appear in the module that reads them; two whole imports (applyRelationalMeta,resolvesToDataColumn) move. Theexportandexport typere-exports at the top ofObjectGrid.tsxare untouched, so the package entry and every exported name are unchanged.ObjectGrid.tsxgoes from 5160 to 3962 lines. The diff is 2674 changed lines in 10 files.Move-only proof. The multiset of non-blank lines of the base
ObjectGrid.tsxequals the newObjectGrid.tsxplus the three modules, except for 10 lines, all of them edited import lines inObjectGrid.tsxthat lost specifiers. Every added line is a module header or docblock, an import, a signature or parameter type, areturn { … }list, or inObjectGrid.tsxone of the three new imports and three calls with their comments.The split, slices 1 to 8. Line counts of
ObjectGrid.tsxonmainafter each merge:objectGridColumns.ts,objectGridDefaults.ts,objectGridLinkCell.tsx,objectGridQuery.ts,objectGridRowVersion.ts,objectGridTranslations.tsFooterSummaryReportobjectGridProps.tsobjectGridDiagnostics.tsobjectGridQueryInputs.ts,objectGridGroupingDecisions.tsobjectGridRowLoad.tsobjectGridGrouping.ts,objectGridSummaries.tsobjectGridRowHeight.ts,objectGridColumnState.ts,objectGridMobile.tsobjectGridGenerateColumns.tsx,objectGridPersistedColumns.ts,objectGridActionsColumn.tsxFinal count:
ObjectGrid.tsxis 3962 lines, down from 7689 (48% smaller), with 19 sibling modules beside it. What remains is the component itself (state, the remaining handlers, the render) and the re-exports.Open PRs on these files. Of the 26 open PRs, one touches
ObjectGrid.tsx: #26804 (opened after this slice's claim), with hunks at the components import, theuseOverlayAnchorcall and the record-overlay props, none of them inside R, U or V.git merge-treeof this head with #26804's head merges with no conflict. No open PR touches the five test files or the three new modules.Why
The card's ruling, verbatim: 「大文件互踩: 立重构卡把 ObjectView 和 ObjectGrid 拆成小模块。这个可以立卡」. One move-only slice per PR, per the card's ask 1 to 5; this is the last slice named in hand-off 6438136564 and dispatch order 6446731987, so the PR closes the card.
Tests
Five test edits, path-only, forced by the move. Each joins the moved file to the source it already read; no assertion, pattern or count changed.
ui/packages/plugin-grid/src/__tests__/columnReadBoundary-6458.test.ts:gridSourcereadsobjectGridGenerateColumns.tsxandObjectGrid.tsxjoined, in that order. TheListColumnbranch ofgenerateColumns()that the scan bounds moved with R, and the order keeps the(schema as any).hideRowHeightTogglecontrol after the region end.ui/packages/plugin-grid/src/__tests__/cellRendererResolutionBoundary-8920.test.ts: the "ObjectGrid.tsx makes no direct resolver call" case readsObjectGrid.tsxandobjectGridGenerateColumns.tsxjoined, because the call sites it guards moved with R.ui/packages/plugin-grid/src/__tests__/relationalMetaCopySet.derivation.test.ts: the LIT CONTROL'swholeFilereads both files joined, because mostfieldMetareads moved with R. TherenderCellEditor:seam stays inObjectGrid.tsx, so the zero it asserts is unchanged.ui/packages/plugin-grid/src/__tests__/gridNonAuthorKeys.test.tsx: the control case also readsobjectGridActionsColumn.tsx, because the NON-AUTHOR SURFACE comment onmaxInlineRowActionsmoved with V.ui/packages/core/src/utils/__tests__/column-identity.ratchet.test.ts: the CONVERGED entry followscolumnIdentity(fromplugin-grid/src/ObjectGrid.tsxtoplugin-grid/src/objectGridGenerateColumns.tsx.percent-storage-callers-11475needs no edit:formatPercentstays in the mobile card inObjectGrid.tsx, and none of the moved lines call it. I matched every string literal of every tracked test and script against the lines that leftObjectGrid.tsx; the other hits were generic words or behavioural tests, and all of them ran green below.Acceptance notes
any, copied from the component's own declarations:datais an any-typed array andobjectSchemaisanyin the component'suseStatecalls, andobjectFieldsis declared in the component as a record ofanyor undefined. The new parameters spell those same types, which is the 6 newno-explicit-anywarnings. Narrowing them would go beyond a move.exhaustive-depsfinding ongenerateColumns(missingnavigationandschema.showColumnTypeIcons) is raised in the new module exactly as before, and the other findings are the same at shifted lines..tsxand V's is.tsxbecause they hold JSX; U's is.ts. The claim saidobjectGrid*.ts.renderCellEditor"(below)" inobjectGridPersistedColumns.tsnow lives inObjectGrid.tsx.objectGridActionsColumn.tsximportsObjectGridComponentPropsfrom./ObjectGridas a type only, so no runtime cycle is added.Verification
Run on head
ab6ff716:pnpm --dir ui exec vitest run packages/plugin-grid/ --maxWorkers=2under the verification lock: 253 of 253 files, 2256 of 2256 tests after the move. Before: the same command on base7bdff7ec(a separate worktree, deps built): 253 of 253 files, 2256 of 2256 tests.column-identity.ratchet,percent-storage-callers-11475,affordanceGrantMap-12082,catalog-gallery-renderandregistry-inputs-spec-parity): 109 of 109 files, 3413 of 3413 tests.pnpm --filter @object-ui/plugin-grid type-checkexit 0, afterturbo run build --filter='@object-ui/plugin-grid^...'.check:*steps plustype-check:coverage: all exit 0 (check:spec-symbolsandcheck:doc-example-readersincluded; no new local type shares a spec name, and no single-return wrapper is exported).pnpm check:changeset-fixedexit 0.pnpm --dir ui run check:new-line-citations(report-only, exit 0) reports 1 new citation:apps/console/src/dev/DevRowActions.tsx:51inobjectGridActionsColumn.tsx. It is not new prose; the comment moved verbatim with V, and the gate counts it because it changed files. It is kept as it was, since rewording it would not be move-only.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 35 derived commands, all exit 0.pnpm --dir ui exec vitest run scripts/under the lock: 178 passed and 2 skipped files, 5065 passed and 2 skipped tests. Its first run hit a 15-second timeout in onecheck-i18n-dead-keysreal-tree case while the gate list ran beside it; the rerun alone was green.--ranreconciles 35 of 35 (0 NOT-MEASURED, 0 UNRUN); the Type Check UI commands above are recorded as outside the derivation.Changeset:
.changeset/25994-objectgrid-columns-modules.md(patch,@object-ui/plugin-grid).Human Minimum
packages/specholds no runtime logic. (not touched)main, one pull request.packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbXqCPeUA7ztE9YWKwP
Generated by Claude Code