Repository navigation
Commit 7939732
fix(components): a wide table's right seam shadow shows when the table widens after its rows are drawn (#37253)
Fixes #37239
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:管理员在工作室「全部元数据」列表(例如共享规则)里,表格比可视区域宽时,右侧固定列前那道提示「右边还有列」的阴影现在每次都会出现;以前大约一半的打开次数不出现。
- 为什么做:夜间回归测试因此变红(共享规则列表在 1440 宽下的可达性检查),这是让它恢复的产品修复。
- 出错会怎样:最坏只是宽表右侧阴影不显示或多显示一次,不影响数据和操作;改动可直接撤回。
- 要你做什么:无。
## What changes
- `ui/packages/components/src/custom/use-horizontal-overflow.ts`
(`useHorizontalOverflow`): the box re-reads its overflow when the box,
each child of the box, **or each child's own children** resize. Before,
it watched the box and its direct children only.
- Why that matters: every table here sits inside the shadcn `Table`
wrapper (`relative w-full`, `overflow-visible` inside a box that
scrolls). The wrapper keeps the box's width, so when the table element
widens past the box with no row added and the box unchanged, no observer
fired, `overflowRight` stayed `false`, and `data-table`'s right seam
shadow (`data-table-scroll-shadow-right`) was never drawn.
- The same hook drives `HorizontalOverflowBox` (`data-overflow-right`
and its edge or pinned seam), so a table placed in that box inside a
wrapper (the approvals inbox mounts one that way) follows the table's
width too. Pinned below; not measured live.
- Changeset: `@object-ui/components` patch.
## Why
Nightly `nightly-tiers` run 45554381420 (`0a1b69c0b`) failed
`ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts`: the seam
shadow was not found within 5 s although the table's scroll box was
wider than its client box.
**Which suspect it is.** #36978 (`c48f06c87`, the metadata list on
ObjectGrid) is the change that exposed it, and is not itself wrong. It
moved the list onto `data-table` and pointed the spec at `data-table`'s
shadow. That shadow carried a latent defect in `useHorizontalOverflow`,
and the new list's layout hits it about half the time. #37089 (the
permission set full-screen) is ruled out: it does not touch this list's
grid or the overflow hook. Nothing else changed the data-table seam
shadow between the last green nightly (`d9c799c10`, 2026-11-24) and the
red one. The only other `data-table.tsx` edit in that window is #37124
(the footer summary row), which does not touch the overflow read.
**Measured DOM** (Chromium 1440x1000, this tree's Console against the
workspace showcase backend, a requestAnimationFrame log of the scroll
box from first paint):
```
before the fix, a failing open (12 of 20 opens ended like this):
+1315ms sw=1134 cw=1134 child=1134 table=1134 rows=3 shadow=false rows drawn, the table fits
+1331ms sw=2168 cw=1134 child=1134 table=2168 rows=3 shadow=false the columns widen the table
+1384ms sw=1826 cw=1134 child=1134 table=1826 rows=3 shadow=false ...and it stays without a shadow
a passing open: the table is already wider than the box when the rows draw (sw=1826 at the first frame)
after the fix (20 of 20 opens with a shadow), the same sequence:
+1379ms sw=1134 cw=1134 child=1134 table=1134 rows=3 shadow=false
+1391ms sw=2168 cw=1134 child=1134 table=2168 rows=3 shadow=false
+1427ms sw=1826 cw=1134 child=1134 table=1826 rows=3 shadow=true
```
`child` is the wrapper, the box's only child, and it stays at 1134
throughout. That is why the old read never ran. The scrollbar-at-rest
read in `data-table` already observed the table element itself, which is
why the bar showed while the shadow did not.
So the product regressed, and the spec is unchanged. It still measures
that the controls are in reach and that a seam shows while columns
remain to the right.
## Tests
- `data-table-scroll-shadow-12463.test.tsx`: a new top-level describe. A
recording `ResizeObserver` calls back only the observers watching the
element that resized, as a browser does. The table element alone grows
past the box (no scroll, no row added), and the shadow is drawn.
CONTROL: a table that grows but still fits draws none.
- `horizontal-overflow-12708.test.tsx`: a new top-level describe, the
same reading for `HorizontalOverflowBox` with a wrapped table. CONTROL:
a resize of the wrapper itself still re-reads.
Read first (by risk):
1. `use-horizontal-overflow.ts`: the nested observe loop. It adds
observers on grandchildren and changes no read.
2. `data-table-scroll-shadow-12463.test.tsx`: the recording observer and
the new describe.
Two-minute check: `pnpm --dir ui exec vitest run
packages/components/src/renderers/complex/__tests__/data-table-scroll-shadow-12463.test.tsx`.
Expect 8 passed, including "draws the shadow once the table alone grows
past the box".
<details><summary>Unit and package runs at ddb6f6f: both pin files
15/15; the whole components package 510 files passed, 1 skipped;
type-check green</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/src/renderers/complex/__tests__/data-table-scroll-shadow-12463.test.tsx packages/components/src/__tests__/horizontal-overflow-12708.test.tsx
Test Files 2 passed (2)
Tests 15 passed (15)
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/
Test Files 510 passed | 1 skipped (511)
Tests 4970 passed | 24 skipped (4994)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @object-ui/components type-check (tsc --noEmit && tsc -p tsconfig.test.json, the ui/ dependency closure built first)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Local gate families at ddb6f6f: 38 derived, 38 run,
every one exit 0</summary>
```
node scripts/pm/dispatch-gates.mjs --ran FILE
Run reconciliation — 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3).
pnpm check:test-source-alias -> exit 0
node scripts/pm/overlap-check.mjs -> VERDICT clean exit 0 (origin/main; and with --pr=37168,37169,37166,37226: every one merges cleanly)
```
</details>
## Acceptance notes
- Ablation (one run, both pins, `scripts/ablation-replace.mjs`):
deleting the grandchild-observe line, `anchor 1 -> 0, blob 7965aaa
-> aae15c0c6be7`, makes both new pins fail. The data-table one fails
with "Unable to find an element by:
data-testid=data-table-scroll-shadow-right", and both CONTROLs stay
green (`Tests 2 failed | 13 passed (15)`). Restored: `blob == HEAD
(7965aaa)`, `git diff HEAD` empty. Both test files import the hook
from source, so no build is involved.
- Size: 4 files, 182 changed lines (176+, 6-).
- Deviation: part of the scratchpad logs (the raw Playwright and probe
outputs) was deleted mid-session by a process this run does not own. The
readings above were copied from those runs as they finished.
## Verification
The stack the nightly boots, step for step:
`ui/e2e/live/ci/start-backend.sh` (this tree's CLI serving
`examples/app-showcase`, a throwaway database), the Console built with
`VITE_BASE_PATH=/` and served by `vite preview`, then Playwright from
`ui/` with `playwright.live.config.ts`, Chromium.
<details><summary>Before the fix (main at d7f299c): the spec fails 5 of
10 repeats, with the nightly's error</summary>
```
playwright test --config=playwright.live.config.ts declared-sharing-rules-reach-13091.spec.ts --repeat-each=10
Error: expect(locator).toBeVisible() failed (Locator: getByTestId('data-table-scroll-shadow-right').first())
5 failed
5 passed (57.3s)
```
</details>
<details><summary>After the fix (Console rebuilt from this branch): 20
of 20, and the whole nightly list 28 of 28</summary>
```
playwright test --config=playwright.live.config.ts declared-sharing-rules-reach-13091.spec.ts --repeat-each=20
20 passed (55.0s)
pnpm --dir ui run test:e2e:live:nightly (the 14 spec files console-live-specs.live.test.ts runs)
28 passed (1.7m)
```
</details>
The backend and the preview server this run started were stopped by
their recorded PIDs.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (CI)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYnxVj5xoUcFUWLa5Aw)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYkkwuF6UuFtu85Yd5H -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9171bed commit 7939732
4 files changed
Lines changed: 176 additions & 6 deletions
File tree
- .changeset
- ui/packages/components/src
- __tests__
- custom
- renderers/complex/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
43 | 54 | | |
44 | 55 | | |
45 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
0 commit comments