update product details

This commit is contained in:
Rami Bitar
2026-06-03 13:41:04 -04:00
parent 4aa55c2b89
commit 3cc7ec376c
42 changed files with 1965 additions and 972 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { useParams } from "react-router";
import { useParams } from "next/navigation";
import type { ShopifyProduct } from "@reacteditor/field-shopify";
import { useProduct } from "@/hooks/use-shopify-products";
import { useShopifyCart } from "@/hooks/use-shopify-cart";
@@ -14,7 +14,9 @@ export type ProductDetailsProps = {
};
export function ProductDetailsView({ product: selected }: ProductDetailsProps) {
const { handle: paramHandle } = useParams<{ handle?: string }>();
const params = useParams();
const paramHandle =
typeof params?.handle === "string" ? params.handle : undefined;
const handle = selected?.handle ?? paramHandle ?? null;
const { product, loading } = useProduct(handle);
const cart = useShopifyCart();