Repository navigation
Description
Summary
Split off #5182.
The header's Save can show a reason why it is off, but only when the editor's controller supplies one as invalidReason (packages/ui/src/components/editor/editor-actions.tsx:183-190). The contract says the reason exists so the reader "learns what blocks the save instead of meeting a dead button" (packages/ui/src/components/editor/types.ts:20-25).
Today only the automation editor supplies one (services/platform/app/features/automations/components/automation-editor.tsx:2085-2105). The form editor (useFormEditor) and the group composer (packages/ui/src/components/editor/compose-editors.ts:46-54) supply none.
So every settings page built on them shows a disabled Save with nothing to explain it whenever:
- an edit fails the schema, and
- the failing field shows no error yet.
With the shared form mode onTouched (packages/ui/src/components/forms/use-form.ts:33), a field's error shows only after the field is left. #5182 met this as a disabled Save with the empty vector width's error hidden.
Read at main 11aac22.
Ask
useFormEditorsupplies aninvalidReasonwhenever its schema fails. The reason names the field that blocks the save, or says why.- The group composer passes on the reason of the editor that blocks.
- Which words to use and how to name the field are open. The automation editor's reason is the existing model.
Constraints
- No reason over nothing to save. It shows only when invalid edits hold Save back, as
EditorActionsalready decides. It does not show while nothing is dirty, or while a save or a load is running. - Where the reason shows. It appears in the tooltip on Save, or inline where the page asks for
inlineReason. - Locales. Every shipped locale gets the new strings.
Related
- bug(platform): Embedding model Save is on with empty fields after a provider change, and off without a reason once a model is picked #5182: the parent issue.
- fix(ui): keep a form editor's Save current when code sets a field #5260: a stale Save after a field is set in code.
Activity