mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 23:16:59 +00:00
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.
This commit is contained in:
parent
7cd1910f82
commit
620f2b0b41
@ -17,7 +17,7 @@ interface ProductSidebarProps {
|
||||
|
||||
const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
|
||||
const addItem = useAddItem()
|
||||
const { openSidebar } = useUI()
|
||||
const { openSidebar, setSidebarView } = useUI()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [selectedOptions, setSelectedOptions] = useState<SelectedOptions>({})
|
||||
|
||||
@ -33,6 +33,7 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
|
||||
productId: String(product.id),
|
||||
variantId: String(variant ? variant.id : product.variants[0]?.id),
|
||||
})
|
||||
setSidebarView('CART_VIEW')
|
||||
openSidebar()
|
||||
setLoading(false)
|
||||
} catch (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user