Skip to content

Commit 452b7be

Browse files
authored
Merge pull request #1237 from firebase/@invertase/bb-9
2 parents 8be837e + 88da289 commit 452b7be

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/angular/src/lib/components/form.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ export class FormErrorMessageComponent {
9696

9797
errorMessage = computed(() => {
9898
const error = this.state().errorMap?.onSubmit;
99-
if (!error) return undefined;
10099

101-
// Handle string errors
102-
return String(error);
100+
// We only care about errors thrown from the form submission, rather than validation errors
101+
if (error && typeof error === "string") {
102+
return error;
103+
}
104+
105+
return undefined;
103106
});
104107
}

packages/react/src/components/form.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ function ErrorMessage() {
6666
return (
6767
<form.Subscribe selector={(state) => [state.errorMap]}>
6868
{([errorMap]) => {
69-
if (errorMap?.onSubmit) {
70-
return <div className="fui-form__error">{String(errorMap.onSubmit)}</div>;
69+
// We only care about errors thrown from the form submission, rather than validation errors
70+
if (errorMap?.onSubmit && typeof errorMap.onSubmit === "string") {
71+
return <div className="fui-form__error">{errorMap.onSubmit}</div>;
7172
}
7273

7374
return null;

0 commit comments

Comments
 (0)