Repository navigation
Commit 0d0ed81
fix(plugin-detail): the record drawer's per-field save asks for the fields a change makes required (#36298)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTRdLmK9YYgMSCJ7NH2PuUY)_
Fixes #35995
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
在看板、日历、甘特图自带的记录抽屉里改一个字段,若这次改动让另一个空字段变成必填,现在会先弹出填写小窗,填好后一次保存;以前直接被服务器拒绝。
- 属于「记录页行内编辑」这一组体验修复:让抽屉和记录页、列表单元格、看板拖拽用同一个填写小窗。
- 出错时影响仅限这个抽屉的保存:小窗点取消什么都不写,可直接撤回本次改动;不触发必填的改动照旧立即保存。
- 无
## What changes
`InlineEditSaveBar`'s callback mode (the record overlay,
`RecordDetailPanel` / `RecordDetailDrawer`) now runs the same
`collectRequiredWhenPromptFields` check with the same `fillable` test as
the atomic mode before its first `onFieldSave`. When fields come back it
writes nothing and opens the shared `RequiredFieldsDialog`; Save sends
the changed field plus the typed values in ONE `dataSource` update with
`If-Match` at the version the edit session began on; Cancel closes the
dialog and keeps the draft; a 409 opens the same conflict dialog the
atomic mode opens, over the fill-in dialog (Cancel comes back to the
typed values, Overwrite resends both at the server's version). A change
that makes nothing required still goes through `onFieldSave` at once.
- `ui/packages/plugin-detail/src/InlineEditSaveBar.tsx` — the ask runs
in both modes when the DataSource props are present; the callback mode's
ask carries the edit session's starting version (`RequiredAsk.ifMatch`);
the plain callback save's 409 still reads as a refusal (the conflict
dialog's overwrite writes through the DataSource, which is not the path
that refused). The edit-base block moved above `handleSave` unchanged so
the save can read it.
- `ui/packages/plugin-detail/src/RecordDetailPanel.tsx` — hands the bar
`dataSource`, `objectName`, `recordId` and `data` (all existing props)
and wraps the bar alone in a `RecordContextProvider` carrying the
panel's `objectSchema`, so the bar knows the object's fields. No new
prop, no new callback shape.
- One `@object-ui/plugin-detail` patch changeset.
Measured caller set (Zone 2.1): the callback mode has exactly one
caller, `RecordDetailPanel` (`RecordDetailDrawer` renders it). It is the
overlay of `ObjectKanban`, `ObjectCalendar`, `ObjectGantt` and
`ObjectTree` (the tree passes no `onFieldSave`, so it is read-only) when
the host routes no row click. Inside the console a list row click opens
`RecordDetailView` in the drawer stack (`objectViewRecordOverlay.tsx`),
whose bar is the atomic mode and already asks since the shared prompt
landed; that file is untouched here.
## Tests
- The pin in `InlineEditSaveBar.requiredPrompt-35956.test.tsx` that said
the callback mode never asks now says it asks and writes nothing yet.
- A new top-level `describe` in the same file (the component's shared
harness, per the ruling that a new pin goes into that file): Save writes
once with both fields and `ifMatch` and never calls `onFieldSave`; the
guard is the version the edit began on even after the host re-reads the
record mid-edit; Cancel writes nothing and keeps the edit; CONTROL — a
change that makes nothing required goes through `onFieldSave` at once; a
409 keeps the fill-in dialog open under the conflict dialog and
Overwrite resends both at the server's version; CONTROL — with no data
source handed over it never asks; and one test through the real
`RecordDetailPanel` + `DetailView` (double-click, edit, Save → dialog →
one guarded update).
<details><summary>Readings</summary>
Recorded at the commit named in the report; see the `os-dev-report`
comment on the card for the full gate list.
- `vitest run InlineEditSaveBar.requiredPrompt-35956.test.tsx` — Test
Files 1 passed, Tests 15 passed.
- 25 plugin-detail test files naming `InlineEditSaveBar` /
`RecordDetailPanel` / `RecordDetailDrawer` — Test Files 25 passed, Tests
163 passed, 10 skipped.
- Ablation (via `scripts/ablation-replace.mjs`, restored to the HEAD
blob with `git diff HEAD` empty): restoring the old `!onFieldSave &&`
guard turns 6 tests red (the flipped pin, Save, the version guard,
Cancel, the 409 and the panel test) while both CONTROLs stay green.
</details>
## Acceptance notes
- The dialog's single write goes through the data source, not through
the host's `onFieldSave`. The kanban and the calendar re-read on the
data source's mutation event, as they do for any write; a host that only
patches its own list inside `onFieldSave` does not see that patch for
this one write. The panel's `record` is the host's snapshot
(`navigation.selectedRecord`) either way, as it already is after a
per-field save.
- Without a data source on the overlay there is no one write to put the
values in, so it saves field by field as before (pinned as a CONTROL).
- Handing the bar `data` also turns on two existing behaviours in the
overlay: the changed-elsewhere notice, and a server refusal naming a
record field reading as a field hint (labelled with the machine name,
since the panel passes no `fieldLabelFor`).
- 375 px / dark: the dialog is the shared one, unchanged here; no
browser check was run for this PR.
## Verification
Files to read first, by risk: `InlineEditSaveBar.tsx` (`handleSave`'s
ask and the 409 gate), `RecordDetailPanel.tsx` (the record context
around the bar), the new `describe` at the end of the test file.
Two-minute check: `cd ui && pnpm exec vitest run
packages/plugin-detail/src/__tests__/InlineEditSaveBar.requiredPrompt-35956.test.tsx`
— expect 15 passed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5oLLK7uoxp33riiBJL
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2ab7601 commit 0d0ed81
4 files changed
Lines changed: 252 additions & 53 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
144 | 161 | | |
145 | 162 | | |
146 | 163 | | |
| |||
317 | 334 | | |
318 | 335 | | |
319 | 336 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
324 | 343 | | |
325 | 344 | | |
326 | 345 | | |
327 | 346 | | |
328 | 347 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
| 348 | + | |
333 | 349 | | |
334 | 350 | | |
335 | 351 | | |
| |||
471 | 487 | | |
472 | 488 | | |
473 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
474 | 505 | | |
475 | 506 | | |
476 | 507 | | |
| |||
480 | 511 | | |
481 | 512 | | |
482 | 513 | | |
483 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
484 | 519 | | |
485 | 520 | | |
486 | 521 | | |
487 | 522 | | |
488 | | - | |
| 523 | + | |
489 | 524 | | |
490 | 525 | | |
491 | 526 | | |
| |||
516 | 551 | | |
517 | 552 | | |
518 | 553 | | |
519 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
520 | 558 | | |
521 | 559 | | |
522 | 560 | | |
| |||
527 | 565 | | |
528 | 566 | | |
529 | 567 | | |
530 | | - | |
| 568 | + | |
531 | 569 | | |
532 | 570 | | |
533 | 571 | | |
| |||
580 | 618 | | |
581 | 619 | | |
582 | 620 | | |
583 | | - | |
584 | 621 | | |
585 | 622 | | |
586 | 623 | | |
| |||
612 | 649 | | |
613 | 650 | | |
614 | 651 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | 652 | | |
629 | 653 | | |
630 | 654 | | |
631 | 655 | | |
632 | | - | |
| 656 | + | |
633 | 657 | | |
634 | 658 | | |
635 | 659 | | |
| |||
678 | 702 | | |
679 | 703 | | |
680 | 704 | | |
681 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
682 | 708 | | |
683 | 709 | | |
684 | 710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
363 | 381 | | |
364 | 382 | | |
365 | 383 | | |
| |||
0 commit comments