From aa74ebb181617f7373e61f3e18cf0f614912985a Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Tue, 9 May 2023 12:25:43 +0200 Subject: [PATCH] fix(admin-ui): ensure that sales channel names are always an array (#4049) --- .changeset/breezy-cougars-tap.md | 5 +++++ .../templates/product-table/use-product-column.tsx | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/breezy-cougars-tap.md diff --git a/.changeset/breezy-cougars-tap.md b/.changeset/breezy-cougars-tap.md new file mode 100644 index 0000000000..523d711b45 --- /dev/null +++ b/.changeset/breezy-cougars-tap.md @@ -0,0 +1,5 @@ +--- +"@medusajs/admin-ui": patch +--- + +fix(admin-ui): ensure that sales channel names are always an array diff --git a/packages/admin-ui/ui/src/components/templates/product-table/use-product-column.tsx b/packages/admin-ui/ui/src/components/templates/product-table/use-product-column.tsx index 9e6db4bc67..c267e8d825 100644 --- a/packages/admin-ui/ui/src/components/templates/product-table/use-product-column.tsx +++ b/packages/admin-ui/ui/src/components/templates/product-table/use-product-column.tsx @@ -27,11 +27,11 @@ const useProductTableColumn = ({ setTileView, setListView, showList }) => { const { store } = useAdminStore() const getProductSalesChannels = (salesChannels) => { - ;(salesChannels || []).sort( - defaultChannelsSorter(store?.default_sales_channel_id || "") - ) + const salesChannelsNames = (salesChannels || []) + .sort(defaultChannelsSorter(store?.default_sales_channel_id || "")) + .map((sc) => sc.name) - return sc.name)} /> + return } const columns = useMemo(