Skip to content

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

Fix bug causing form to revert changes if object instead of string was used

dominik-zeglenbd8651e1fec6
diff --git a/saleor/static/dashboard-next/components/Form/Form.tsx b/saleor/static/dashboard-next/components/Form/Form.tsx
index c15beb78da..7579afbbaf 100644
--- a/saleor/static/dashboard-next/components/Form/Form.tsx
+++ b/saleor/static/dashboard-next/components/Form/Form.tsx
@@ -37,7 +37,8 @@ class FormComponent<T extends {} = {}> extends React.Component<
): FormState<T> {
const changedFields = Object.keys(nextProps.initial).filter(
nextFieldName =>
- nextProps.initial[nextFieldName] !== prevState.initial[nextFieldName]
+ JSON.stringify(nextProps.initial[nextFieldName]) !==
+ JSON.stringify(prevState.initial[nextFieldName])
);
if (changedFields.length > 0) {
const swapFields = changedFields.reduce((prev, curr) => {