Repository navigation
fix(plugin-form): the ?form overlay for a record that does not exist shows the not-found state, not an empty editable form - #29246
Merged
Conversation
… shows the not-found state
DataSource.findOne answers null for a record that does not exist, and the
dialog seeded its form with {} from that answer: a blank editable form with
an enabled Update button. A null edit read is now a RecordNotFoundError
load failure, drawn as the console's record not-found state with no form
and no footer.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jRxwsTHrYtG7dozRj9
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRxwsTHrYtG7dozRj9
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRxwsTHrYtG7dozRj9
Contributor
Author
|
domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu 席位核对 · ACCEPT · 2026-11-02T10:27ZHead-sha:
|
This was referenced Nov 2, 2026
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.
Requested by Steedos · project thread
Fixes #29157
Clause-②: no
Metadata-protocol: none
Declarations as set by the claim (card comment 6573647843), which fixes the file surface:
ModalForm.tsx, its privateloadFailure.ts, their tests and a root changeset. DrawerForm, TabbedForm and WizardForm stay out by the claim.维护者速读
?form=ID)打开一条不存在的记录时,现在显示「Record not found」未找到状态(与记录页相同的文案),不再显示可编辑的空白「编辑」表单,也没有「更新」按钮。新建(?form=new)和编辑已存在的记录不变。/forms路由会直接拒绝,两处入口不一致。ModalForm的记录读取:findOne按契约对不存在的记录返回null,此前被当成空记录{}填进表单,现在记为一次加载失败并画未找到状态。表单打开期间记录被删、后台重读得到null时也显示同一状态。回滚即还原本 PR。ui/packages/plugin-form/src/ModalForm.tsx的记录读取 effect(data == null分支)与renderContent开头的RecordNotFoundError分支;ui/packages/plugin-form/src/loadFailure.ts末尾新增的RecordNotFoundError。pnpm --dir ui exec vitest run packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsx,预期 1 个文件、4 个测试全绿。What changes
DataSource.findOneis typedT | null, and the ObjectStack adapter'sreadOneanswersnullwhen the server answers 404.ModalForm's record read ransetFormData(data || {})and committed, so the console's?form=IDoverlay (AppContent mountsModalFormwithmode: 'edit'and the URL's id) drew a blank editable form with an enabled Update button for a record that does not exist. The read now fails with a newRecordNotFoundErrorfrom the package-privateloadFailure.ts, through the same per-read failure run every other load failure uses, and the form is not seeded.renderContentdraws aRecordNotFoundErroras the console's record not-found state (EmptywithEmptyTitleandEmptyDescription, asRecordDetailViewdraws it), not as the red "Error loading form" box. The dialog's footer is already off while a load failure is set, so there is no Update or Cancel button; the dialog still closes by its X, Escape or the backdrop.empty.recordNotFoundandempty.recordNotFoundDescription, present in every locale pack. Their English values are added only toModalForm's privatecreateSafeTranslationfallback table, so a host with no i18n provider still reads English.useRecordInvalidation) that finds the record deleted while the dialog is open shows the same state.?form=new, or no id) never reads; an edit of a record that exists draws its form as before.AppContent.tsxis not in the diff. The master-detail arm (an object with subforms) reads throughMasterDetailFormand is not touched.Tests
ModalForm.recordNotFound-29157.test.tsxmountsModalFormthe way the console overlay does (object-form,formType: 'modal',mode: 'edit', an id,open: true) with the real registered fields. It pins: anullread draws "Record not found" and its description, nonameinput, no Update button and no "Error loading form"; a found record that a bus re-read then finds deleted switches to the same state; CONTROL a found record still draws its form and Update; CONTROL a create draws an empty form with Create and never callsfindOne.Acceptance notes
7fa9873f. Here the chain is pinned in vitest from thefindOneanswer down; the adapter's 404 tonullmapping is read fromObjectStackAdapter.readOne(is404Error), not re-exercised.AppContent), outside the claim's surface; the body says the record is not found.DrawerForm,TabbedFormandWizardFormseed their forms withdata || {}on a null record read in the same way. Reported to the seat for one follow-up card.Verification
New pin · 4/4 here, 2 red against main's ModalForm
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsxunderos-verify-lockatd68406a2: Test Files 1 passed (1), Tests 4 passed (4).Reverse check at
64c17e66:ModalForm.tsxandloadFailure.tsrestored from the basededc3505(theRecordNotFoundErrorcount on disk 0), same command: Tests 2 failed, 2 passed. Both not-found cases failed with "Unable to find an element with the text: Record not found"; both CONTROLs passed. A throwaway probe on the same restored tree asserted the base behaviour directly and passed: thenameinput is present, empty and enabled, and the Update button is present and enabled. Restored withgit restore --source=HEAD --staged --worktree;git diff HEADempty,git status --porcelainempty, the probe file removed.plugin-form package, overlay hosts, type check and lint
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/(locked, code at6733bc41): Test Files 218 passed (218), Tests 2411 passed, 1 skipped.ModalFormin app-shell, the console, plugin-view and plugin-designer (theAppContent.*overlay tests among them), after aturbo run build --filter='@object-ui/console^...': Test Files 30 passed (30), Tests 241 passed.turbo run type-check --filter=@object-ui/plugin-form(tsc --noEmit && tsc -p tsconfig.test.json): exit 0;tsc -p tsconfig.test.jsonagain atd68406a2: exit 0.eslinton the three changed.ts/.tsxfiles: 0 errors; the warnings are all on lines outside this diff's hunks.pnpm --dir ui run check:new-line-citations: 0 new citations.Derived gates
node scripts/pm/dispatch-gates.mjs --commandsderived 34 commands against merge basededc35051. The 33 non-vitest gates ran in one loop starting at6733bc41and all exited 0, includingcheck-sdui-manifest.mjsand its--self-test,check:nul-bytes,check:cross-package-test-inputs,check:test-source-alias,check:type-check-debtandcheck:query-options-erasure.pnpm --dir ui exec vitest run scripts/atd68406a2: Test Files 169 passed, 2 skipped; Tests 4900 passed, 2 skipped.dispatch-gates --ranreconciled 34 derived, 34 run, 0 NOT-MEASURED.d68406a2only retypes the new test file.origin/mainmoved 12 commits since the base, none touchingui/packages/plugin-form/,AppContent.tsxor the en locale pack.Generated by Claude Code