Update react editor

This commit is contained in:
Rami Bitar
2026-06-04 11:49:01 -04:00
parent 7f86072636
commit 8a558d3217
18 changed files with 140 additions and 262 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { useParams } from "next/navigation";
import { useRouteHandle } from "@/lib/resolve-route";
import type { ShopifyProduct } from "@reacteditor/field-shopify";
import { useProduct } from "@/hooks/use-shopify-products";
import { useShopifyCart } from "@/hooks/use-shopify-cart";
@@ -14,10 +14,8 @@ export type ProductDetailsProps = {
};
export function ProductDetailsView({ product: selected }: ProductDetailsProps) {
const params = useParams();
const paramHandle =
typeof params?.handle === "string" ? params.handle : undefined;
const handle = selected?.handle ?? paramHandle ?? null;
const routeHandle = useRouteHandle();
const handle = selected?.handle ?? routeHandle ?? null;
const { product, loading } = useProduct(handle);
const cart = useShopifyCart();
const [activeImage, setActiveImage] = useState(0);