mosh-hamedani / issue-tracker

https://issue-tracker-pied.vercel.app
220 stars 101 forks source link

Unhandled Runtime Error #5

Open LowkeyGud opened 1 year ago

LowkeyGud commented 1 year ago

Typing any params(string) after https://issue-tracker-pied.vercel.app/issues/ sends unnecessary fetch request to database resulting runtime error as intParse fails in

app\issues[id]\page.tsx fetchUser(parseInt(params.id));

Simple solution: Check before database call

export async function generateMetadata({ params }: Props) {
  if (isNaN(parseInt(params.id))) notFound();
  const issue = await fetchUser(parseInt(params.id));