Skip to content

docs(ui): state the inlineForm validate contract the code implements - #324

Merged
argszero merged 1 commit into
mainfrom
docs/inlineform-validate-contract
Sep 29, 2026
Merged

argszero merged 1 commit into
mainfrom
docs/inlineform-validate-contract

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

ui/README.md:90 (the ## 行内组件约定 section, "禁用原生弹窗" bullet) said an inlineForm opts.validate error is surfaced as "toast + 重新聚焦". The code has not done that since 2d492ee (#47): ui/js/app.js's finish() calls setFieldError(input, err) — no toast, no explicit refocus.

The same file already states the correct behaviour, at line 133 (## 一致性约定, "行内编辑校验"): "inlineForm 的 opts.validate 失败走 setFieldError(红边框+行内文案)… 不使用 toast 承载错误". So the document contradicted itself, and only line 90 was wrong.

Provenance is drift, not a trade-off:

grep -rn "重新聚焦" over the repository matched this one line only, and no gate in src/ quotes it — it is prose nothing pins, which is exactly how it survived.

Related Issue

None. Found during reconnaissance; no issue was opened for it.

Changes

  • ui/README.md — line 90's parenthetical now reads `opts.validate` 失败走 `setFieldError`(红边框+行内文案),不使用 toast, matching line 133 and ui/js/app.js. One line; docs only. No cache-bust token: ui/README.md is not a served asset.

  • 功能/修复说明 (prose only: one stale contract corrected to the implemented behaviour)

  • 涉及配置/数据结构的改动已同步示例文件 (not applicable — no config/data change)

Tests

Checklist

  • 分支命名符合约定(docs/)
  • Commit message 使用 Conventional Commits 格式(docs(ui): ...)
  • 单一职责,改动最小化 (1 file, +1/−1)

ui/README.md:90 (the inline-components section) said an inlineForm
`opts.validate` error is surfaced as "toast + 重新聚焦". That was true at
birth (990cd5a, #41) but 2d492ee (#47) changed the code to
`setFieldError(input, err)` and added the `## 一致性约定` section, which
states at line 133 that inline-edit validation goes through
`setFieldError` and explicitly does not use a toast. Only line 90 was
left behind, so the same file contradicted itself and the code.

Fix the wording to match line 133 and the implementation; no behaviour
change, no new i18n keys.
@argszero

Copy link
Copy Markdown
Owner Author

Self-review (Committer, allow_self_merge): CI green — msrv pass, test / fmt / clippy pass (426 tests, 0 failed). Diff is a single docs line; local cargo test / cargo fmt --check / cargo clippy --all-targets -D warnings all pass (note ui/README.md is include_str!-ed at src/state_gate.rs:12457, so the full suite was re-run for this docs change). No review feedback outstanding. Merging.

@argszero
argszero merged commit dee6a24 into main Sep 29, 2026
2 checks passed
@argszero
argszero deleted the docs/inlineform-validate-contract branch September 29, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant