Repository navigation
fix(app-shell): refuse an empty required screen-flow field at the field, as the record form does - #26956
Merged
Conversation
Submit with a required field left empty raised one toast and nothing in the dialog. Each missing field now shows its message under the control, the control is marked aria-invalid and described by it, and focus moves to the first missing field; Submit stays and no resume request is made. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQtUhXRiBQeTgVcy19
…nner suites The file-field and flows-translation suites pinned the old missing-required toast; they now read the message drawn under the field, and assert no toast. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQtUhXRiBQeTgVcy19
Contributor
Author
席位核对ACCEPT · seat
Landing: no contract review is owed (no published schema, no governed text, |
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 #26882
Clause-②: no
Metadata-protocol: none
维护者速读
aria-invalid),光标跳到第一个漏填的字段,「提交」按钮保留,不发请求、不弹 toast,与记录表单一致。ui/packages/app-shell/src/views/FlowRunner.tsx的submit(必填检查改为字段级);ScreenView.tsx的errors属性与字段下方的消息;新测试FlowRunner.requiredAtField-26882.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/__tests__/FlowRunner.requiredAtField-26882.test.tsx,预期 5 个用例全绿。What changes
FlowRunner'ssubmitused to answer a missing required field with onetoast.error(wizard.missingRequired) and nothing in the dialog. It now records a per-field message (validation.required, "Due Date is required", in the display locale and naming the localized label), moves focus to the first missing field in screen order, and returns without a request. No toast: the record form raises none for a client-side refusal either, because each refused field carries its own message. Submit stays. Editing a field retires its own message.ScreenViewdraws the message. A new optionalerrorsprop (field name to message) draws the message under the control the way the record form'sFormMessagedoes, and marks the control:aria-invalidon the plain input, textarea and select trigger, and the publishederrorslot on the platform widgets (date and date-time pickers, lookup, upload, checkbox), which setaria-invalidon their own control. The control'saria-describedbynames the message after any help text. The Studio preview passes noerrorsand renders as before.INVALID_SCREEN_INPUTkeeps the screen, the typed values and Submit, with the sentence in the banner; the resubmit goes to the same run.FlowRunner.fileField-25801,FlowRunner.flowsTranslation-5920) now read the message drawn at the field and assert no toast. Theenlocale comment that namedwizard.missingRequiredas the runner's borrowed key now namesvalidation.required; no catalogue row changes.Tests
FlowRunner.requiredAtField-26882.test.tsx(5 cases): an empty required date (message under it,aria-invalid, described by it, focused, Submit enabled, no request, no toast); several missing fields each with a message and focus on the first; answering a field retires its message and the next Submit resumes; the message inzhnames the label; a retryableINVALID_SCREEN_INPUTkeeps both typed values and Submit, and the resubmit reaches the same run.FlowRunner.tsxandScreenView.tsxchecked out from7a2818c5, 4 of the 5 fail, each naming the missing sentence (Unable to find an element with the text: Due Date is required); the retryable case passes there too, as expected, since that behaviour already existed. Restored fromHEAD, proved by an emptygit diff HEADand equal blob hashes.Acceptance notes
7a2818c5, jsdom, the card's screen shape): Submit with Due Date empty made 0 resume requests, raised the toast "Please complete the required fields: Due Date", and left 0 elements witharia-invalid. So the untouched date was empty to the check (the PM's alternative, a non-empty untouched date, does not hold); the refusal's only carrier was a transient toast outside the dialog.refusedend, or a resume answered400 FLOW_FAILED/404/ a failed run under200. On those, the engine has already consumed the suspension:resumeInternalcallsforgetSuspendedRunbefore it traverses the downstream nodes (an order ruled for exactly-once, per the comment abovestepCountAtPauseinservice-automation'srun-resume.ts), and the only door that re-arms it,POST /automation/FLOW/runs/RUN/restore-suspension, is an operator verb. Which of the two terminal paths HotCRM's Generate Quote takes for "Discount cannot exceed 60%" is NOT MEASURED: the HotCRM flow is outside this repository. Either way the fix is on the flow's side: declaring the bound on the screen field (max: 60on the discount field) makes the engine refuse it asINVALID_SCREEN_INPUTbefore it consumes the suspension (retryable: values and Submit kept, this PR's last test), and the dialog refuses it before any request.min/maxbound refusal is still a toast only (screenFieldBoundViolations). Moving it to the field is the same mechanism (an entry inerrors); it is left as an open question to the seat rather than changed here.Verification
Head of the measured tree: see the final report on the card.