Files
react-editor-shopify/app/[[...path]]/page.tsx
2026-05-02 09:18:15 -04:00

27 lines
764 B
TypeScript

import { notFound } from "next/navigation";
import { readSchema } from "~/lib/schema.server";
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 data = schema[lookup];
if (!data) return notFound();
return <RenderClient data={data} route={lookup} />;
}