Skip to content

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

Fix type error

dominik-zeglenad6647508d1e
diff --git a/saleor/static/dashboard-next/components/Form/Form.tsx b/saleor/static/dashboard-next/components/Form/Form.tsx
index 968fdcf4dc..d9186244ad 100644
--- a/saleor/static/dashboard-next/components/Form/Form.tsx
+++ b/saleor/static/dashboard-next/components/Form/Form.tsx
@@ -16,16 +16,6 @@ export interface FormProps<T extends {}> {
onSubmit?(data: T);
}
-const shallowCompare = (a, b) => {
- let ret = true;
- Object.keys(a).forEach(k => {
- if (a[k] !== b[k]) {
- ret = false;
- }
- });
- return ret;
-};
-
class Form<T extends {} = {}> extends React.Component<FormProps<T>, T> {
state: T = this.props.initial;
@@ -64,7 +54,8 @@ class Form<T extends {} = {}> extends React.Component<FormProps<T>, T> {
contents = children({
change: this.handleChange,
data: this.state,
- hasChanged: !shallowCompare(this.props.initial, this.state),
+ hasChanged:
+ JSON.stringify(this.props.initial) !== JSON.stringify(this.state),
submit: this.handleSubmit
});
}
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index ca0c24ef33..7c6161da24 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -157,7 +157,8 @@ export const ProductUpdate = decorate<ProductUpdateProps>(
description: product ? product.description : "",
featured: product && product.isFeatured ? product.isFeatured : false,
name: product ? product.name : "",
- price: product && product.price ? product.price.amount : undefined,
+ price:
+ product && product.price ? product.price.amount.toString() : undefined,
seoDescription: product ? product.seoDescription : "",
seoTitle: product && product.seoTitle ? product.seoTitle : ""
};
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index f25560f5d6..ce14894202 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -1,6 +1,6 @@
import * as React from "react";
-
import { arrayMove } from "react-sortable-hoc";
+
import * as placeholderImg from "../../../images/placeholder255x255.png";
import ErrorMessageCard from "../../components/ErrorMessageCard";
import Navigator from "../../components/Navigator";