Repository navigation
feat(console): a public form's thank-you panel shows the record field values its {{record.field_name}} tokens name - #28493
Merged
Conversation
… tokens from the submit answer
The panel's title and message replace each {{record.field_name}} token with
the value the public submit answer carries under `fields`, read through the
spec's PublicFormSubmitResponseSchema. The names come from the spec's
thankYouRecordFieldNames, so the page carries no token grammar of its own; a
name with no value fills as empty and a value is drawn as text.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibySWZrcTi5MPXZ61kx
… changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibySWZrcTi5MPXZ61kx
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibySWZrcTi5MPXZ61kx
Contributor
Author
|
domain:ui#1 · os-tesla · session_01L9qibw2uhdSeHYfnZdAf4V 席位意见:同意。匿名表单提交后的感谢面板把 席位核对ACCEPT · head
|
This was referenced Nov 1, 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.
domain:ui#1 · os-tesla · session_01L9qibySWZrcTi5MPXZ61kx
Requested by Tesla · project thread
Fixes #28444
Clause-②: no
Metadata-protocol: semantic
Skills-docs: updated here — content/docs/ui/public-data-collection.mdx, content/docs/ui/forms.mdx
维护者速读
title/message里的{{record.case_number}}这类占位符现在会替换成提交应答fields里的值(例如工单号 CASE-0042),不再把占位符原文显示给访客。ui/apps/console/src/components/FormPage.tsx的fillThankYouPanel与readThankYouAnswerFields,以及提交switch里新的thank-you分支。pnpm --dir ui exec vitest run apps/console/src/components/FormPage.thankYouRecordFields-28444.test.tsx,预期 9 个用例全绿。What changes
ui/apps/console/src/components/FormPage.tsx:readThankYouAnswerFields(answer)readsfieldsoff the public submit answer throughPublicFormSubmitResponseSchema(@objectstack/spec/api). An answer that is not that shape (the schema is strict) carries no fields.fillThankYouPanel(panel, fields)replaces each token in the panel'stitleandmessage. Which tokens a text holds isthankYouRecordFieldNames(@objectstack/spec/ui); each named field's token is then its literal{{record.+ name +}}spelling, split out of the text with a plain stringsplit. There is no regex in the Console for this token. A name with no value in the answer (or anObject.prototypekey such asconstructor) fills as empty. A filled value is never read for tokens again, and the page draws the result as a React text child, so a value is text, never markup.switchgets its ownthank-youarm: on the public route it stores the answer's fields, and the confirmation panel draws the filled text. The internal route's answer isCreateDataResponse, not this shape, so it is not read (see Acceptance notes).ui/packages/data-objectstack/**is untouched: the public submit is a directapiFetchinFormPage.tsx(submitPublic), which hands back the bare JSON body, sofieldsis not dropped anywhere on the way.Docs (the card's Skills-docs rider):
content/docs/ui/forms.mdx(section 8, after thekindtable) andcontent/docs/ui/public-data-collection.mdx(after thesubmitBehaviorparagraph) each gain one sentence and one example, and both say only an engine-generated field (autonumber) may be named.Root changeset
.changeset/28444-thank-you-record-fields.md:@object-ui/consoleminor (Metadata-protocolsemantic).Tests
New
ui/apps/console/src/components/FormPage.thankYouRecordFields-28444.test.tsx(the realFormPageon/f/:slug, fetch stubbed):{{record.case_number}}show the answer'sCASE-0042.fieldsrenders the token as empty, and no{{reaches the DOM.imgtag and abtag shows as literal text; no such element is created.idandfieldsfails the strict schema and fills nothing.fillThankYouPanel: a value that itself spells another name's token is not filled again;{{record.constructor}}fills as empty; a panel with no token is returned as authored.readThankYouAnswerFields: readsfieldsoff the public answer; reads none off aCreateDataResponseorundefined.Ablation (one run, not kept):
node scripts/ablation-replace.mjsreplaced thefillThankYouPanel(...)call in the render with the raw panel text. The rendered tests went 4 failed, 5 passed (all four render pins red; the five helper unit pins stay green, as they call the helper directly). Restored; blob back to the HEAD bloba4ac3681,git diff HEADempty.Acceptance notes
GET /forms/:slugserves the translated view'sconfig(translateMetadataDocument('view', …)inpackages/rest/src/form-routes.ts), so the Console reads the tokens of the translated text. The submit answer'sfieldsis built fromthankYouRecordFieldNames(match.form?.submitBehavior), the base text. So a translation that names a field the base text names fills; a translation that names a field the base does not renders that token empty, never as the token text. Not widened./forms/:name) form that declares athank-youpanel with tokens renders them empty: its answer isCreateDataResponse, whichPublicFormSubmitResponseSchema(strict) refuses, and the card scopes the fill to the public answer. Before this PR it showed the token text. Filling it from the internal answer'srecordwould be a second source; left for a card if wanted.titlethat is only a token with no value now renders an empty heading rather than the default "Thank you!" (the card: empty, never the token text).submitRedirect.tskeeps its ownRECORD_TOKEN_REfor theredirectarm; it is unchanged here.Verification
Measured on head
b88d54a9(main base9b4d1933). After mergingorigin/mainat8c3f9d93(head60fc7181; the merge brings only #28490, no file this PR touches),apps/console/src/components/was re-run: 55 files, 594 tests passed.Tests
pnpm --dir ui exec vitest run apps/console/src/components/: 55 files, 594 tests passed (includes the new file andFormPage.submit.test.tsx).pnpm --filter @object-ui/console type-check: exit 0, 0 errors (after a full dts build of./packages/**and the@object-ui/console^...closure; the console tsconfig includessrc, so the new test file is compiled).Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 66 families, every one exit 0, includingnode scripts/check-sdui-manifest.mjsand its self-test,pnpm check:test-source-alias,pnpm check:cross-package-test-inputs,pnpm check:undeclared-dep-imports,pnpm check:doc-authoring,pnpm check:docs-transcript-drift,node scripts/check-changeset-no-major.mjs --base origin/main,pnpm --filter @objectstack/spec run check:docs, andpnpm --dir ui exec vitest run scripts/(171 files, 4901 passed, 2 skipped).pnpm check:query-options-erasurehit a 280 s per-gate timeout in the first sweep and passed (exit 0) when re-run without one.--ranreconciliation: 66 derived, 66 run, 0 NOT-MEASURED.pnpm check:new-line-citations(ui): 0 new citations.Generated by Claude Code