You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9f6f306
Browse filesBrowse the repository at this point in the historyBrowse files
fix(console): Hide column in the column-header menu joins the list draft, like the View settings eye (#36380)
Part of #35955 — this PR builds the one acceptance item the
coordinator's run found failing on the column-header menu; the card
stays open for the spec half of item 5 (the view schema's `columnState`
key), which needs `packages/spec` and is routed to #36403.
Clause-②: yes (widening) — measured on the built declarations:
`ui/packages/types/dist/data-display.d.ts` gains
`DataTableSchema.onColumnHide?: (columnKey: string) => void` (the zod
mirror declares it as a by-name refusal, so the authored accept set does
not widen), and `ui/packages/plugin-grid/dist/ObjectGrid.d.ts` gains the
optional prop `onColumnHide?: (field: string) => void`; nothing removed
or renamed
Metadata-protocol: none
## 维护者速读
- 列表用户在列头菜单里点「隐藏列」后,标签行右边会出现「放弃」「保存」,和在「视图设置」里点眼睛一样;以前列消失了却没有这两个按钮,只能刷新。
- 属于「列表页重做」专题里「列表上的改动都是临时的」那张卡,补上协调席验收时唯一没通过的一项。
- 出错时最坏是列头隐藏又回到以前的样子(列消失但没有按钮);不写服务端、不动视图,撤回这个改动即可恢复原状。
- 无
## What changes
The coordinator's acceptance run on the card (comment 7070433857) failed
one item: 「列头菜单里的「隐藏列」不出现「放弃」「保存」。列消失、没有写请求、刷新后恢复…同一个操作从「视图设置」里点眼睛就是好的。」
Measured on origin/main 3a81fb7: the column menu's "Hide column"
(`hideColumn` in `data-table.tsx`) only filtered the table's own
`columns` state and told nobody, so the list never heard of it and the
draft store never saw it. The eye in View settings writes through
`ListView`'s hide-fields writer (`updateListedFields`, then
`onHiddenFieldsChange`), which the Console's `persistHiddenFields` turns
into `listDraft.patch({ hiddenFields })`.
- `@object-ui/types`: a new runtime slot
`DataTableSchema.onColumnHide(columnKey)`, refused by name on the zod
mirror like `onColumnsReorder`; the mirror-parity ledger (`KnownDrift`,
51 entries / 92 keys), the declared-keys type pin and the handler-keys
refusal census (`handler-keys-json-refusal-6124`: RUNTIME_SLOT row +
KeepsFunction entry, 61 slots / 83 ids) carry it.
- `@object-ui/components` `data-table`: "Hide column" still hides the
column in the table at once, and now also calls
`schema.onColumnHide?.(columnKey)`.
- `@object-ui/plugin-grid` `ObjectGrid`: a new optional host prop
`onColumnHide(field)`, forwarded onto the data-table node (so the
grouped grid's per-group tables carry it too).
- `@object-ui/plugin-list` `ListView`: hands the grid `onColumnHide`,
which writes through the eye's own writer (`updateListedFields`): the
host hears `onHiddenFieldsChange` with the whole hidden list, an added
column leaves the reader's added fields instead of being hidden (as
unticking it does), and a key that names no column the list draws
reports nothing. No app-shell change: the Console's existing
`persistHiddenFields` already puts that list in the draft, so Discard
brings the column back and Save keeps it hidden on both save paths.
Not touched: `listDraftStore.ts`, `ObjectView.tsx`,
`objectViewListRenderer.tsx` (a parallel card is editing them), and
`data-table.tsx` outside `hideColumn` (#36332 edits that file elsewhere;
overlap-check clean against every open PR).
## Tests
- New:
`ui/packages/plugin-grid/src/__tests__/ObjectGrid.headerMenuHide-35955.test.tsx`
— through the real `ObjectGrid` and `data-table`, opening a header's
menu and picking "Hide column" calls the host's `onColumnHide` once with
`'stage'` and the column goes; CONTROL: with no handler the column still
goes.
- New block `ListView.headerMenuHide-35955` in the shared harness
`ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx` (four
cases: reported as the eye does and the grid drops the column; adds to
columns already hidden and a second hide of a hidden one reports
nothing; an added column leaves the added fields; an unknown key reports
nothing).
- Updated: `zod-mirror-parity.test.ts` (KnownDrift key set and header
figure), `data-table-declared-keys-6882.test.ts` (declared + exact
shape), `handler-keys-json-refusal-6124.test.ts` (RUNTIME_SLOT row,
KeepsFunction entry, pins 60 → 61 and 82 → 83; da38b48).
- No test migrated, retired or rewritten.
<details><summary>Runs (head 47950b6 unless noted; final head da38b48
adds one test-only commit: handler-keys census + zod-mirror-parity +
types type-check 385/385 passed, CI 47 success / 15 skipped / 0
failed)</summary>
- Locked build of the closure: `pnpm --workspace-concurrency=2 --filter
'@object-ui/plugin-list^...' --filter '@object-ui/plugin-grid^...'
build` — VERDICT command-exit 0.
- `pnpm --dir ui exec vitest run --maxWorkers=2` over the new grid pin,
the ListView harness, `zod-mirror-parity`,
`data-table-declared-keys-6882` and `data-table-header-menu-35876` —
Test Files 5 passed (5), Tests 194 passed (194) (on 0df3436; the 6882
type pin is compile-time, judged by type-check below).
- `pnpm --workspace-concurrency=2 --filter @object-ui/types --filter
@object-ui/components --filter @object-ui/plugin-grid --filter
@object-ui/plugin-list run type-check` — all four Done, VERDICT
command-exit 0 (on 0df3436).
- `pnpm --filter @object-ui/types run type-check` on 47950b6 — clean;
reverse leg: changing the declared member to `(columnKey: number) =>
void` turned it red at the new shape pin
(`data-table-declared-keys-6882.test.ts`, TS2344 `Type 'false' does not
satisfy the constraint 'true'`), so the pin reads the declaration;
restored, blob == HEAD, `git diff HEAD` empty.
- Ablation A (`scripts/ablation-replace.mjs`, src-resolved through the
ui vitest alias, no dist leg): deleting
`schema.onColumnHide?.(columnKey);` from `data-table.tsx` turned the
grid pin red (1 failed | 1 passed, the CONTROL green); restored, blob ==
HEAD, `git diff HEAD` empty.
- Ablation B: deleting the `updateListedFields(...)` line of
`hideColumnFromMenu` in `ListView.tsx` turned three of the four harness
cases red (the "reports nothing" case stays green by construction);
restored, blob == HEAD.
</details>
## Acceptance notes
- Work-item survey of the card against origin/main 3a81fb7 (every 「要做的」
and 验收 item): all are present except (1) this header-menu hide, built
here, and (2) item 5's 「规范里为个人列布局开的口子(`columnState`)」:
`packages/spec/src/ui/view.zod.ts` still declares `columnState:
ViewColumnStateSchema.optional()` on the view item and on the list
overlay. Retiring it is a `packages/spec` change, so this PR leaves it
to the seat. The sign-out keep of browser layout (ruling 7064241116) is
its own card, #36110, and the coordinator's untested items (kanban
drafts, a second user, a mouse drag of a header) read as draft paths in
code: a header drag goes `onColumnsReorder` → `ObjectGrid` column state
→ `onColumnStateChange` → the draft's `columnOrder`.
- A table with no host handler (any `data-table` outside a list) keeps
today's behaviour: the hide lives in the table's own state.
## Verification
First read (by risk):
1. `ui/packages/plugin-list/src/ListView.tsx` — `hideColumnFromMenu` and
its `onColumnHide` spread on the grid: the routing through
`updateListedFields`.
2. `ui/packages/components/src/renderers/complex/data-table.tsx` —
`hideColumn`, the one added call.
3. `ui/packages/plugin-grid/src/ObjectGrid.tsx` — the prop and its
forward onto `dataTableSchema`.
Two-minute check: on a Console list with a shared grid view, click a
column header and pick "Hide column": the column goes and 「放弃」「保存」
appear at the right of the tab row; 「放弃」 brings the column back, and the
network panel shows no write.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds)_
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jUc3qp6bHKSWijbjds -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(console): Hide column in the column-header menu is a list draft, like the eye in View settings
9
+
10
+
Clause-②: yes (widening) — one new optional runtime slot `DataTableSchema.onColumnHide(columnKey)` (refused by name on the zod mirror, like `onColumnsReorder`) and one new optional `ObjectGrid` prop `onColumnHide(field)`; nothing removed or renamed
11
+
Metadata-protocol: none
12
+
13
+
On a Console object list, picking "Hide column" in a column header's menu hid the column inside the table only: nothing above the table heard of it, so the list drew neither Discard nor Save and only a reload brought the column back. The same choice made with the eye in View settings was already a draft.
14
+
15
+
The table now reports the hidden column to its host (`DataTableSchema.onColumnHide`, supplied by `ObjectGrid` from its new `onColumnHide` prop), and `ListView` writes it through the same writer as the hide-fields eye: the host hears it on `onHiddenFieldsChange` (the Console holds it in the list's draft, so Discard brings the column back and Save keeps it hidden), and a column the reader added leaves their added fields, as unticking it does. A table with no host handler hides the column in its own state, as before.
0 commit comments