From 620f2b0b41170ffb89ed43ee5fa2669daeff2fee Mon Sep 17 00:00:00 2001 From: ltueth <49448537+ltueth@users.noreply.github.com> Date: Sat, 12 Mar 2022 22:44:35 +0100 Subject: [PATCH] Sets correct Sidebar view when adding a product If the last selected view on mobile was the menu, it was shown instead of the cart when adding a product. --- site/components/product/ProductSidebar/ProductSidebar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/components/product/ProductSidebar/ProductSidebar.tsx b/site/components/product/ProductSidebar/ProductSidebar.tsx index 250aa41bc..e549ed698 100644 --- a/site/components/product/ProductSidebar/ProductSidebar.tsx +++ b/site/components/product/ProductSidebar/ProductSidebar.tsx @@ -17,7 +17,7 @@ interface ProductSidebarProps { const ProductSidebar: FC = ({ product, className }) => { const addItem = useAddItem() - const { openSidebar } = useUI() + const { openSidebar, setSidebarView } = useUI() const [loading, setLoading] = useState(false) const [selectedOptions, setSelectedOptions] = useState({}) @@ -33,6 +33,7 @@ const ProductSidebar: FC = ({ product, className }) => { productId: String(product.id), variantId: String(variant ? variant.id : product.variants[0]?.id), }) + setSidebarView('CART_VIEW') openSidebar() setLoading(false) } catch (err) {