fix(forms): show unavailable save failures as a status, not an input error (F-10)
Save failures outside sign-in, permission and retry still went into ErrorSummary under "review the entered information". They now reach FormFailureStatus with their own copy and action; the unused copy is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d7b81c633d
commit
67117cc5a5
@@ -82,7 +82,7 @@ export function ErrorSummary<Values extends FormValues>(props: Readonly<{
|
||||
|
||||
/**
|
||||
* 08-01. A save that failed for a reason other than the input (sign-in,
|
||||
* permission, retry later) is announced here with its own action, not in
|
||||
* permission, retry later, unavailable) is announced here with its own action, not in
|
||||
* ErrorSummary. Pass `useAppForm().failure`.
|
||||
*/
|
||||
export function FormFailureStatus(props: Readonly<{
|
||||
|
||||
@@ -239,8 +239,10 @@ export function useAppForm<
|
||||
outcome.error.kind === "FORBIDDEN" ? "forbidden" : "retry-later",
|
||||
);
|
||||
} else {
|
||||
// F-10. Not an input error either: shown by FormFailureStatus.
|
||||
unknownSubmissionRef.current = null;
|
||||
setFormErrors(["form.unavailable"]);
|
||||
setFormErrors([]);
|
||||
setStatusFailure(outcome.error);
|
||||
setResult("unavailable");
|
||||
}
|
||||
},
|
||||
@@ -350,7 +352,10 @@ export function useAppForm<
|
||||
formErrors,
|
||||
pending,
|
||||
result,
|
||||
/** The save failure behind `reauth-required`, `forbidden` or `retry-later`. */
|
||||
/**
|
||||
* The save failure behind `reauth-required`, `forbidden`, `retry-later`
|
||||
* or `unavailable`.
|
||||
*/
|
||||
failure: STATUS_RESULTS.has(result) ? statusFailure : null,
|
||||
field,
|
||||
fieldId,
|
||||
@@ -371,6 +376,7 @@ const STATUS_RESULTS: ReadonlySet<FormResultState> = new Set([
|
||||
"reauth-required",
|
||||
"forbidden",
|
||||
"retry-later",
|
||||
"unavailable",
|
||||
]);
|
||||
|
||||
function issuesToFieldErrors<Values extends FormValues>(
|
||||
|
||||
Reference in New Issue
Block a user