Repository navigation
fix(plugin-form): the default ObjectForm edit of a record that does not exist shows the not-found state, not an empty editable form - #29417
Merged
Conversation
…he not-found state A null findOne answer in edit mode now fails the record read with RecordNotFoundError and draws the shared RecordNotFoundState, as the modal, drawer, tabbed and wizard layouts already do, instead of seeding a blank editable form. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
…ndState callers Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
…t a missing one An edit form now draws the record not-found state for a null read, so the control case answers an empty record for its own id to keep a surface with controls and no fixture values behind it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jS5aiikUDKUDJZeY1u
Contributor
Author
|
domain:ui#3 · zhuangjianguo · session_01QsR2jV4dWohojjbTJTQq5m 席位核对 · ACCEPT · 2026-11-02T15:02ZHead-sha:
|
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 #29354
Clause-②: no
Metadata-protocol: none
Declarations as set by the claim (card comment 6578598549), which fixes the file surface:
ObjectForm.tsx,loadFailure.tsonly for a small extension of its helper, their tests and a root changeset.维护者速读
simple)的对象表单在编辑一条不存在的记录时,现在显示「Record not found」未找到状态,不再显示可编辑的空白表单,也没有「更新」按钮。这是五种记录表单里最后一个缺这个状态的;画法复用 PR fix(plugin-form): drawer, tabbed and wizard edit forms for a record that does not exist show the not-found state, not an empty editable form #29351 在loadFailure.ts里加的同一个私有组件。新建和编辑已存在的记录不变。findOne返回null时记一次RecordNotFoundError加载失败、不再把null填进表单;原有「加载失败时不画表单」的提前返回接管其余。表单打开期间后台重读发现记录已删,也显示同一状态(与其余四种表单一致)。回滚即还原本 PR。ui/packages/plugin-form/src/ObjectForm.tsx记录读取 effect 里的data == null分支,以及SimpleObjectForm渲染开头error instanceof RecordNotFoundError的分支。pnpm --dir ui exec vitest run packages/plugin-form/src/ObjectForm.recordNotFound-29354.test.tsx,预期 1 个文件、8 个测试全绿。What changes
DataSource.findOneis typedT | null, and the ObjectStack adapter'sreadOneanswersnullwhen the server answers 404.SimpleObjectForm(the defaultobject-formarm) passed that answer straight tosnapshotLoadedRecordandsetInitialDataand committed the read, so an edit form for a deleted or unknown record drew a blank editable form with an enabled Update button. It now fails the record read with the package-privateRecordNotFoundError, through the per-read failure run every other load failure uses, and neither seeds the form nor takes a save baseline. This is the branch the four other record layouts already take.RecordNotFoundError, the layout returns the shared privateRecordNotFoundState(test idsimple-form-record-not-found) ahead of the generic "Error loading form" box. That early return is the one that already kept the form, its footer and its submit off screen for any load failure.useRecordInvalidation) that finds the record deleted while the form is open shows the same state, as in the drawer, tabbed and wizard layouts. A later re-read that finds the record again commits and takes the screen back, as for any record read failure.loadFailure.ts: one JSDoc line now namesObjectForm's default arm among the callers ofRecordNotFoundState(comment only; the seat confirmed it is inside the claimed surface).Why
A user who opens an old link to a deleted record in the default object form saw a blank form, filled it in, and learned the record did not exist only on save.
Tests
ObjectForm.recordNotFound-29354.test.tsx, onedescribe.eachover the flat and the sectioned render paths ofObjectForm(noformType, so the default arm, with the real registered fields): anullread draws "Record not found", its description and thesimple-form-record-not-foundtest id, with notitleinput, 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
findOneanswer down; the adapter's 404 tonullmapping is read fromObjectStackAdapter.readOne, not re-exercised, and no Console route that mounts the default layout for an edit was driven.loadedRecordRef), as in the other layouts: nothing can save while the not-found state is drawn, and the next successful read replaces it.Verification
New pin · 8/8 here; the 4 not-found cases red with the null check dropped
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/src/ObjectForm.recordNotFound-29354.test.tsx packages/plugin-form/src/recordNotFound-29247.test.tsx packages/plugin-form/src/ModalForm.recordNotFound-29157.test.tsxunderos-verify-lockat47103058: Test Files 3 passed (3), Tests 24 passed (24).Ablation 1 at
bde6a7fa(drop the null check only):node scripts/ablation-replace.mjsreplaced the anchorif (data == null) {(followed by therun.fail(new RecordNotFoundErrorline) withif (data == null && false) {, anchor 1 to 0, blob9076fe06c494to53ebc1eb3468. New test file alone: Tests 4 failed, 4 passed (8). The four failures are the two not-found cases on each render path, each "Unable to find an element with the text: Record not found"; the four CONTROLs passed. The tool restored the file: blob equal to HEAD9076fe06c494,git diff HEADempty.Ablation 2 at
bde6a7fa(whole fix out):ObjectForm.tsxrestored from the baseb7720782withgit restore --source(on disk:RecordNotFoundErrorcount 0,if (data == null)count 0),loadFailure.tskept at HEAD: the same 4 failed, 4 passed. Restored withgit restore --source=HEAD --staged --worktreeunder an EXIT trap;git hash-objectequal to the HEAD blob,git diff HEADempty,git status --porcelainempty.At the final head
53e0b949(after mergingmainat7f277a86, which touched no plugin-form file): the closure rebuilt (47 tasks), then the three not-found files plusObjectForm.test.tsxandObjectForm.invalidationRefetch-10572.test.tsx: Test Files 5 passed (5), Tests 37 passed (37).plugin-form package, type check and lint
pnpm --dir ui exec vitest run --maxWorkers=2over all 222 plugin-form test files in three locked batches atbde6a7fa: 74 files / 485 tests, 67 files / 699 tests, 81 files / 1263 passed + 1 skipped. Total 222 files passed, 2447 passed, 1 skipped.turbo run type-check --filter=@object-ui/plugin-form(tsc --noEmit && tsc -p tsconfig.test.json; the test project lists the new file): exit 0 atbde6a7fa,47103058and53e0b949.eslinton the three changed.ts/.tsxfiles: 0 errors; the new test has no warning (its schema is typed asObjectFormComponentProps['schema'], notany).pnpm --dir ui run check:new-line-citations: 0 new citations.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands, the same 34 against merge basesb7720782and7f277a86. The 33 non-vitest gates ran in one loop starting atbde6a7faand all exited 0,check-sdui-manifest.mjsand its--self-test,check:nul-bytes,check:query-options-erasure,check:type-check-debtandcheck:test-source-aliasamong them;pnpm --dir ui exec vitest run scripts/at47103058: Test Files 169 passed, 2 skipped; Tests 4921 passed, 2 skipped.dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED.At the final head
53e0b949:check-sdui-manifest,check-changeset-no-major,check-adr-0087-registration,check-empty-changeset,check:nul-bytes,check:cross-package-test-inputs,check:test-source-alias,check:undeclared-dep-imports,check:type-check-debt,check:type-check-coverageandcheck:published-filesall exit 0. The other 22 derived gates were last measured frombde6a7faon; the commits since change one test line's cast and mergemain.Human Minimum
packages/specholds no runtime logic. (no spec change)pnpm lintpasses. (eslint on the changed files: 0 errors)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code