Files
react-editor-shopify/app/[[...path]]/page.tsx
2026-05-02 10:01:13 -04:00

28 lines
861 B
TypeScript

import { notFound } from "next/navigation";
import { readSchema } from "@/lib/schema.server";
import { resolveSchemaEntry } from "@/lib/schema-resolver";
import RenderClient from "@/components/RenderClient";
export const dynamic = "force-dynamic";
export default async function Page({
params,
}: {
params: Promise<{ path?: string[] }>;
}) {
const { path } = await params;
const segments = (path ?? []).filter(Boolean);
// The /edit branch is handled by app/edit; this catch-all only serves view.
if (segments[0] === "edit") return notFound();
const route = "/" + segments.join("/");
const lookup = route === "/" ? "/" : route.replace(/\/$/, "");
const schema = await readSchema();
const resolved = resolveSchemaEntry(schema, lookup);
if (!resolved) return notFound();
return <RenderClient data={resolved.data} route={lookup} />;
}