Skip to content

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

Drop key prop in forms

dominik-zeglenfe3d28124c6b
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index b1e98970ae..5ae8277b27 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -94,12 +94,7 @@ export const CategoryUpdatePage = decorate<CategoryUpdatePageProps>(
seoTitle: ""
};
return (
- <Form
- onSubmit={onSubmit}
- initial={initialData}
- errors={userErrors}
- key={JSON.stringify(category)}
- >
+ <Form onSubmit={onSubmit} initial={initialData} errors={userErrors}>
{({ data, change, errors, submit, hasChanged }) => (
<Container width="md">
<PageHeader
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index 872dc484c1..b5c06616ff 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -67,7 +67,6 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(
seoTitle: maybe(() => collection.seoTitle)
}}
onSubmit={onSubmit}
- key={JSON.stringify(collection) + isFeatured}
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
diff --git a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
index ee660a4fd5..f10e028029 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerDetailsPage/CustomerDetailsPage.tsx
@@ -62,7 +62,6 @@ const CustomerDetailsPage = decorate<CustomerDetailsPageProps>(
isActive: maybe(() => customer.isActive),
note: maybe(() => customer.note)
}}
- key={JSON.stringify(customer)}
onSubmit={onSubmit}
>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
diff --git a/saleor/static/dashboard-next/orders/components/OrderHistory/OrderHistory.tsx b/saleor/static/dashboard-next/orders/components/OrderHistory/OrderHistory.tsx
index da82ca8e30..3fd0b96813 100644
--- a/saleor/static/dashboard-next/orders/components/OrderHistory/OrderHistory.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderHistory/OrderHistory.tsx
@@ -127,11 +127,7 @@ const OrderHistory = decorate<OrderHistoryProps>(
/>
{history ? (
<Timeline>
- <Form
- initial={{ message: "" }}
- onSubmit={onNoteAdd}
- key={JSON.stringify(history)}
- >
+ <Form initial={{ message: "" }} onSubmit={onNoteAdd}>
{({ change, data, submit }) => (
<TimelineAddNote
message={data.message}
diff --git a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
index 8c3ed64127..5f2d04513e 100644
--- a/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
+++ b/saleor/static/dashboard-next/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx
@@ -114,12 +114,7 @@ const ProductTypeDetailsPage = decorate<ProductTypeDetailsPageProps>(
<Toggle>
{(openedDeleteDialog, { toggle: toggleDeleteDialog }) => (
<>
- <Form
- errors={errors}
- initial={formInitialData}
- onSubmit={onSubmit}
- key={JSON.stringify(productType)}
- >
+ <Form errors={errors} initial={formInitialData} onSubmit={onSubmit}>
{({ change, data, hasChanged, submit }) => (
<Container width="md">
<PageHeader title={pageTitle} onBack={onBack} />
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index e2bd91286a..b79c3443b9 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -185,12 +185,7 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
product && product.productType && product.productType.hasVariants;
return (
- <Form
- onSubmit={onSubmit}
- errors={userErrors}
- initial={initialData}
- key={product ? JSON.stringify(product) : "loading"}
- >
+ <Form onSubmit={onSubmit} errors={userErrors} initial={initialData}>
{({ change, data, errors, hasChanged, submit }) => (
<>
<Container width="md">
diff --git a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
index 82730d7eb4..82b26fb823 100644
--- a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
+++ b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx
@@ -60,12 +60,7 @@ const SiteSettingsPage = decorate<SiteSettingsPageProps>(
name: maybe(() => shop.name, "")
};
return (
- <Form
- errors={errors}
- initial={initialForm}
- onSubmit={onSubmit}
- key={JSON.stringify(shop)}
- >
+ <Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ change, data, errors: formErrors, hasChanged, submit }) => (
<Container width="md">
<PageHeader
diff --git a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
index 772978f81f..98ee1ecc05 100644
--- a/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
+++ b/saleor/static/dashboard-next/staff/components/StaffDetailsPage/StaffDetailsPage.tsx
@@ -69,11 +69,7 @@ const StaffDetailsPage = decorate<StaffDetailsPageProps>(
)
};
return (
- <Form
- initial={initialForm}
- onSubmit={onSubmit}
- key={JSON.stringify({ staffMember, permissions })}
- >
+ <Form initial={initialForm} onSubmit={onSubmit}>
{({ data, change, hasChanged, submit }) => (
<Container width="md">
<PageHeader