diff --git a/dashboard/final-example/app/ui/invoices/create-form.tsx b/dashboard/final-example/app/ui/invoices/create-form.tsx
index 715ff71f..cdbc4066 100644
--- a/dashboard/final-example/app/ui/invoices/create-form.tsx
+++ b/dashboard/final-example/app/ui/invoices/create-form.tsx
@@ -44,17 +44,14 @@ export default function Form({ customers }: { customers: CustomerField[] }) {
- {state.errors?.customerId ? (
-
- {state.errors.customerId.map((error: string) => (
-
{error}
+
+ {state.errors?.customerId &&
+ state.errors.customerId.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
{/* Invoice Amount */}
@@ -77,17 +74,14 @@ export default function Form({ customers }: { customers: CustomerField[] }) {
- {state.errors?.amount ? (
-
- {state.errors.amount.map((error: string) => (
-
{error}
+
+ {state.errors?.amount &&
+ state.errors.amount.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
{/* Invoice Status */}
@@ -129,24 +123,21 @@ export default function Form({ customers }: { customers: CustomerField[] }) {
- {state.errors?.status ? (
-
- {state.errors.status.map((error: string) => (
-
{error}
+
+ {state.errors?.status &&
+ state.errors.status.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
- {state.message ? (
-
- ) : null}
+
+ {state.message ? (
+
{state.message}
+ ) : null}
+
- {state.errors?.customerId ? (
-
- {state.errors.customerId.map((error: string) => (
-
{error}
+
+ {state.errors?.customerId &&
+ state.errors.customerId.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
{/* Invoice Amount */}
@@ -84,17 +81,14 @@ export default function EditInvoiceForm({
- {state.errors?.amount ? (
-
- {state.errors.amount.map((error: string) => (
-
{error}
+
+ {state.errors?.amount &&
+ state.errors.amount.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
{/* Invoice Status */}
@@ -138,24 +132,21 @@ export default function EditInvoiceForm({
- {state.errors?.status ? (
-
- {state.errors.status.map((error: string) => (
-
{error}
+
+ {state.errors?.status &&
+ state.errors.status.map((error: string) => (
+
+ {error}
+
))}
-
- ) : null}
+
- {state.message ? (
-
- ) : null}
+
+ {state.message ? (
+
{state.message}
+ ) : null}
+
-
+
{state === 'CredentialsSignin' && (
<>
-
- Invalid credentials
-
+
Invalid credentials
>
)}