Repository navigation
Commit 6cc1b3e
fix(app-shell): a phone record bar never leads with an Edit that is off, whatever turned it off (#35133)
Fixes #35099
repo:objectstack#1 · os-warren · session_01JQwxbXBffgVtUPBEY2nLFm
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:手机上的记录页,「编辑」因为任何原因不可用时(对象的 `userActions.edit.disabledWhen`
成立,或记录状态让编辑表单所有字段只读),灰掉的「编辑」都从底部操作栏第一个位置退到「···」菜单里,第一个位置让给能点的动作。之前只有审批锁定时才这样。
- **为什么改**:手机底部第一个位置是主操作位,被一个点不了的「编辑」占着,用户第一眼看到的是灰按钮。
-
**风险与回滚**:只改控制台手机端一个条件,不改权限、请求或元数据。桌面端标题行仍把灰掉的「编辑」留在原位(三种原因都有测试钉住),「编辑」可用时完全不变。回滚=还原本
PR。
- **先看**:① `ui/packages/app-shell/src/views/RecordDetailView.tsx` 中
`sys_edit` 的 `editOff` 和 `phonePage && editOff` 一行;②
`RecordDetailView.phoneFace-27058.test.tsx` 末尾新增的 describe。
- **两分钟验证**:手机宽度(390)打开一条状态让所有字段只读的记录:右上角有「Not editable in its current
state」标记,底部第一个按钮可点,「编辑」在「···」里且是灰的。
- **需要你做的**:无,席位落地。
## What changes
- **Phone bottom bar: an Edit that is off leaves the first slot, for
every reason.** The host's Edit is disabled on `approvalLocked ||
editDisabledByPredicate || editLockedByState`. That expression is now
one local, `editOff`, and the phone placement reads it: `...(phonePage
&& editOff ? { component: 'action:menu' } : {})`. Before, only
`approvalLocked` moved Edit into the bar's `⋯`. Edit stays drawn and
stays disabled inside the `⋯`, and the bar's queue moves up, so the
first declared action takes the slot.
- **The promotion needed no change.** The bar draws whatever is not
`action:menu` in order, as it already did for the approval case. The new
pins measure this for both new reasons.
- **Desktop unchanged for every reason.** The `phonePage` gate is
untouched, so the desktop header row keeps Edit greyed in place, as
#35016 scoped it (pinned below for all three reasons).
- **The reason stays readable where one exists.** The state lock keeps
its `record-state-lock` badge ("Not editable in its current state"),
drawn on the phone too (pinned). The approval lock keeps its band. A
`disabledWhen`-disabled Edit has no reason text on any surface, desktop
included: `userActions.edit` declares `enabled` / `visibleWhen` /
`disabledWhen` and no reason key. What a phone reader sees is the same
as on desktop, an "Edit" entry that is off (`aria-disabled="true"`). See
Acceptance notes.
## Tests
One top-level describe is added to the existing phone harness
`RecordDetailView.phoneFace-27058.test.tsx`: "a phone bar never leads
with an Edit that is off, for any reason (objectstack#35099)". It mounts
a real `RecordDetailView`. The page declares Convert Lead and Assign.
- phone (390), `userActions.edit.disabledWhen: "record.status == 'new'"`
holding: the bar reads [Convert Lead][Assign][More actions], its first
button is enabled, and Edit is in the bar's menu with
`aria-disabled="true"`;
- phone, `editLockedByState` (every form field carries that
`readonlyWhen`): the same bar, the same disabled Edit in the menu, and
the state-lock badge is drawn;
- control, phone: a `disabledWhen` that does not hold keeps
[Edit][Convert Lead][More actions] with Edit enabled;
- control, desktop (1440): `disabledWhen`, `editLockedByState` and the
approval lock each keep Edit disabled in the header row, and no bottom
bar is mounted.
The approval-locked phone pin from #35016 is unchanged and still green.
The PM route suggested a new file named for this card. Root `AGENTS.md`
says a new pin for a component with a shared harness file goes into that
file as a top-level `describe`, not a new file. So the block joins the
phone harness that already holds the #35016 pin, with its mount helpers.
<details><summary>Targeted run, phone harness (code head
ffc67c8)</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/RecordDetailView.phoneFace-27058.test.tsx
Test Files 1 passed (1)
Tests 20 passed (20)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Every RecordDetailView test file in app-shell (code
head ffc67c8)</summary>
```
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/RecordDetailView packages/app-shell/src/views/__tests__/RecordDetailView
Test Files 95 passed (95)
Tests 713 passed (713)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>app-shell type-check (head b8e4436; both halves, src
and tsconfig.test.json)</summary>
```
pnpm --filter @object-ui/app-shell type-check
error TS count: 0
os-verify-lock: VERDICT command-exit 0
```
`tsc -p tsconfig.test.json --listFiles` lists
`RecordDetailView.phoneFace-27058.test.tsx`, so the new block is
type-checked.
</details>
<details><summary>Ablation: the condition put back to the approval lock
alone (scripts/ablation-replace.mjs)</summary>
The anchor `...(phonePage && editOff ? { component: 'action:menu' } :
{}),` was replaced with `...(phonePage && approvalLocked ? { component:
'action:menu' } : {}),`. The anchor went x1 to x0 and the replacement x0
to x1, and the blob went b2305bf to 0931ed4cbccd. The suite
resolves `RecordDetailView` from `src` by a relative import, so no build
leg applies.
```
× phone, edit.disabledWhen holds: Edit is in the bar's ⋯, off, and Convert Lead leads
× phone, editLockedByState: Edit is in the bar's ⋯, off, Convert Lead leads, and the badge states why
Tests 2 failed | 18 passed (20)
ablation-replace: ok restored: blob == HEAD (b2305bf) and `git diff HEAD` is empty
```
Only the two new phone pins went red. The approval pin, the controls and
the desktop pins stayed green, which is expected because the ablation
keeps the approval branch and does not touch desktop.
</details>
## Acceptance notes
- **No reason text for `disabledWhen`.** The card asks that the disabled
reason stay readable. For `editLockedByState` and the approval lock it
does (the badge and the band). For `edit.disabledWhen`, no reason exists
to show on any surface: the spec's `userActions.edit` object has no
reason key, and the desktop row shows a greyed Edit with no tooltip
either. On a phone the reader gets the same cue as on desktop, an "Edit"
entry that is visibly off, now in the `⋯`. No new reason string was
invented here. A readable reason would need a declared reason key on
`userActions.edit` / `delete` (a spec addition, `Metadata-protocol:
added`), which is a contract decision and outside this card.
- **The inline-edit draft greying is not moved.**
`disableDuringInlineEdit` greys Edit in the `page:header` renderer while
an inline draft is live. That state is transient and owned by the
renderer, not one of the host's disable reasons, and the card names
`disabledWhen` and `editLockedByState`. It is left as it was.
- No browser run against a live backend was made for this card. The unit
mount covers the bar's order and the disabled overflow entry for each
reason.
## Verification
Local gate families come from `node scripts/pm/dispatch-gates.mjs
--commands --repo objectstack-ai/objectstack` at b8e4436: 39 commands,
all exit 0. The `--ran` reconciliation reads "39 derived, 39 run, 0
NOT-MEASURED, 0 UNRUN", with every exit code recorded. Per-command
readings are in the dev report on #35099. CI runs the required set.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent aef42cb commit 6cc1b3e
3 files changed
Lines changed: 131 additions & 9 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views
| 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 | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4720 | 4720 | | |
4721 | 4721 | | |
4722 | 4722 | | |
| 4723 | + | |
4723 | 4724 | | |
4724 | 4725 | | |
4725 | 4726 | | |
| |||
4765 | 4766 | | |
4766 | 4767 | | |
4767 | 4768 | | |
4768 | | - | |
4769 | | - | |
4770 | | - | |
4771 | | - | |
4772 | | - | |
4773 | | - | |
4774 | | - | |
4775 | | - | |
4776 | | - | |
| 4769 | + | |
| 4770 | + | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
4777 | 4779 | | |
4778 | 4780 | | |
4779 | 4781 | | |
| |||
0 commit comments