Skip to content

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

Fix bug preventing category from being added

dominik-zeglen2b728027e1d8
diff --git a/saleor/static/dashboard-next/categories/urls.ts b/saleor/static/dashboard-next/categories/urls.ts
index 0abf642264..49af6028be 100644
--- a/saleor/static/dashboard-next/categories/urls.ts
+++ b/saleor/static/dashboard-next/categories/urls.ts
@@ -15,4 +15,4 @@ export const categoryAddPath = (parentId?: string) => {
return urlJoin(categorySectionUrl, "add");
};
export const categoryAddUrl = (parentId?: string) =>
- categoryAddPath(encodeURIComponent(parentId));
+ categoryAddPath(parentId ? encodeURIComponent(parentId) : undefined);
diff --git a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
index 347dea8215..352dda30d1 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
@@ -58,7 +58,7 @@ export const CategoryCreateView: React.StatelessComponent<
title: formData.seoTitle
}
},
- parent: parentId
+ parent: parentId || null
}
})
}