Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with 404 #191

Open
emeczku opened this issue Nov 6, 2023 · 2 comments
Open

Issue with 404 #191

emeczku opened this issue Nov 6, 2023 · 2 comments

Comments

@emeczku
Copy link

emeczku commented Nov 6, 2023

If the backend is available and we try to navigate to a URL that is not available, we get the following error:

Unhandled Runtime Error
Error: Cannot read properties of undefined (reading 'name')

@luluhoc
Copy link
Contributor

luluhoc commented Nov 19, 2023

This is an error in starter if category doesn't exists

file app/(main)/[...category]/page.tsx

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { product_categories } = await getCategoryByHandle(
    params.category
  ).catch((err) => {
    notFound()
  })

  const category = product_categories[0]

  return {
    title: `${category?.name} | Acme Store`,
    description: `${category?.name} category`,
  }
}

@luluhoc
Copy link
Contributor

luluhoc commented Nov 19, 2023

Check out my pull

#196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants