Skip to content

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

Fix bug causing null and undefined to be legit IDs

dominik-zeglen14a5e77f21b6
diff --git a/saleor/static/dashboard-next/categories/index.tsx b/saleor/static/dashboard-next/categories/index.tsx
index e8e988088b..e1753da835 100644
--- a/saleor/static/dashboard-next/categories/index.tsx
+++ b/saleor/static/dashboard-next/categories/index.tsx
@@ -32,7 +32,9 @@ const CategoryCreate: React.StatelessComponent<
> = ({ match }) => {
return (
<CategoryCreateView
- parentId={match.params.id ? decodeURIComponent(match.params.id) : null}
+ parentId={
+ match.params.id ? decodeURIComponent(match.params.id) : undefined
+ }
/>
);
};
@@ -54,6 +56,9 @@ export const categoryAddUrl = (parentId?: string) => {
return `/categories/add/`;
};
export const categoryUrl = (id?: string) => {
- return `/categories/${id ? `${id}/` : ""}`;
+ if (id) {
+ return `/categories/${id}/`;
+ }
+ return "/categories/";
};
export default Component;