Next.js Discord

Discord Forum

Dynamic Route error but don't know where it originates from.

Unanswered
Brown Jay posted this in #help-forum
Open in Discord
Brown JayOP
Error: Route / with dynamic = "error" couldn't be rendered statically because it used searchParams.toJSON. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering

7 Replies

Brown JayOP
All of these code are already commented just for sake of trying to make it work
but it still doesn't work
⨯ Error: Route / with `dynamic = "error"` couldn't be rendered statically because it used `searchParams.toJSON`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering
at trackDynamicDataAccessed (/home/daysling/Projects/Repos/portfolio-nextjs/.next/server/chunks/ssr/node_modules__pnpm_2b9d7f._.js:3168:15)
at Object.get (/home/daysling/Projects/Repos/portfolio-nextjs/.next/server/chunks/ssr/node_modules__pnpm_2b9d7f._.js:3318:418)
at stringify (<anonymous>)
digest: "3468148277"
All the other parts, Section1, Section2 and ScreenshotGallery has been commented.
"use client";

import { Suspense } from "react";
import PageBox from "@/components/core/PageBox";
import Modal from "@/components/core/Modal";
import GalleryImageView from "@/components/common/GalleryImageView";
import Head from "next/head";
/*
{
  params,
  searchParams,
}: Readonly<{ params: any; searchParams: any }>*/
const ProjectDetails = () => {
  return (
    <>
      <Head>
        <script async src="//s.imgur.com/min/embed.js" />
      </Head>
      <PageBox>
        <Suspense>
          {/* <ProjectsSection1 />
          <ProjectsSection2 /> */}
        </Suspense>
      </PageBox>
      {/* {!!searchParams.imgSrc ? (
        <Modal closeHref={`/projects?id=${searchParams.id}`}>
          <Suspense>
            <GalleryImageView src={searchParams.imgSrc} />
          </Suspense>
        </Modal>
      ) : null} */}
    </>
  );
};

export default ProjectDetails;