Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
nextjs dynamic with query it returns 404

I encountered an unexpected behavior, in which if I click a link it displays successfully but when I refresh it, it went to 404 page. I suspected it has something with the route list upon reading the code.

From /products/?keyword=&status=draft&type=all to /products/1/?isDraft=true

export default function Custom404() {
  const [fallback, setFallback] = useState(true)

  useEffect(() => {
    const fn = async () => {
      const pages = await Router.router?.pageLoader.getPageList()
      if (!pages || !Array.isArray(pages)) {
        setFallback(false)
        return
      }

      const resolvedRoute = resolveDynamicRoute(Router.asPath, pages) // /sdfsdfs
      if ((pages as string[]).includes(resolvedRoute)) {
        // display page
      } else {
        // return custom 404
      }
    }
    fn()
  })
}

I've been to this stack-link seems its not same case in my end, and also my trailingSlash was already set to true still not working.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!