Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix form data initial data

Krzysztof Bialoglowicz61106f67e84b
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index 1e417f960b..ca41daeeb8 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -55,11 +55,11 @@ const CustomerDetailsPage: React.StatelessComponent<
<Form
errors={errors}
initial={{
- email: maybe(() => customer.email),
- firstName: maybe(() => customer.firstName),
+ email: maybe(() => customer.email, ""),
+ firstName: maybe(() => customer.firstName, ""),
isActive: maybe(() => customer.isActive, false),
- lastName: maybe(() => customer.lastName),
- note: maybe(() => customer.note)
+ lastName: maybe(() => customer.lastName, ""),
+ note: maybe(() => customer.note, "")
}}
onSubmit={onSubmit}
confirmLeave
diff --git a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
index 7156935e34..a104b703b9 100644
--- a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
@@ -58,8 +58,8 @@ const StaffDetailsPage: React.StatelessComponent<StaffDetailsPageProps> = ({
onSubmit
}: StaffDetailsPageProps) => {
const initialForm: FormData = {
- email: maybe(() => staffMember.email),
- firstName: maybe(() => staffMember.firstName),
+ email: maybe(() => staffMember.email, ""),
+ firstName: maybe(() => staffMember.firstName, ""),
hasFullAccess: maybe(
() =>
permissions.filter(
@@ -71,7 +71,7 @@ const StaffDetailsPage: React.StatelessComponent<StaffDetailsPageProps> = ({
false
),
isActive: maybe(() => staffMember.isActive, false),
- lastName: maybe(() => staffMember.lastName),
+ lastName: maybe(() => staffMember.lastName, ""),
permissions: maybe(() => staffMember.permissions, []).map(perm => perm.code)
};
return (