fix(plugin-form,i18n): form edit saves send If-Match and surface 409 conflicts instead of silently overwriting - #3060
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
…conflicts instead of silently overwriting Every form variant (ObjectForm/ModalForm/DrawerForm/TabbedForm/SplitForm/ WizardForm) wrote records back with an unguarded dataSource.update — two racing editors both got a 200 and the later save silently erased the earlier one. The server already honours If-Match (409 CONCURRENT_UPDATE) and the DataSource contract forwards opts.ifMatch; the forms were the only link not sending it. New shared useOccSave (occSave.tsx): the edit save carries ifMatch = the updated_at the form read via findOne; a 409 opens a conflict dialog whose exits are "Keep editing" (nothing written, form and draft stay open) and "Overwrite" (retry re-keyed to the server's currentVersion). Records without a string updated_at degrade to the old unguarded write. Dialog copy added to all ten locales under form.conflict*. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
console 编辑表单保存不带条件请求头:两个基于同一版本的并发编辑双双 200,后写静默覆盖先写(EHR 真机复测 021)。服务端早已支持
If-Match→409 CONCURRENT_UPDATE,DataSource 契约也有opts.ifMatch,唯独表单这一环没接——行内编辑(InlineEditSaveBar)接了,经典编辑表单没有。修复
useOccSave(packages/plugin-form/src/occSave.tsx):编辑保存带ifMatch= 表单findOne读到的updated_at;409 弹冲突对话框——继续编辑(不写入,表单和草稿保留)或覆盖保存(以 409 返回的currentVersion重试)。dataSource.update,全部接入。updated_at(旧后端/无时间戳对象)自动降级为原无守护写入;非冲突错误走原错误路径。form.conflict*)。测试
occSave.test.tsx8 例:ifMatch 传递、无版本降级、继续编辑不二次写入且草稿保留、覆盖用新版本号重试、非冲突错误正常抛出、Modal 冲突后不关闭。🤖 Generated with Claude Code