Next.js Discord

Discord Forum

Learning Docs issue with loading/creating the edit invoices page

Answered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
Hello I am on chapter 12 of the learning doc and on steps 1-3 once finishing step 3 my web page does not display and i get a 404 error. I have refollowed the whole chapter 3 times and re-read everything and I just can't find what I am doing wrong.

I could post all the relevant code here but I'm not sure if that is too bloated, I could also zip the whole folder and upload it. For now I will just post the 3 relevant blocks of code here.

My table.tsx

My page.tsx in invoices/id/edit/page.tsx
import Form from '@/app/ui/invoices/edit-form';
import Breadcrumbs from '@/app/ui/invoices/breadcrumbs';
import { fetchInvoiceById, fetchCustomers } from '@/app/lib/data';
 
export default async function Page({ params }: { params: { id: string } }) {
  const id = params.id;
  const [invoice, customers] = await Promise.all([
    fetchInvoiceById(id),
    fetchCustomers(),
  ]);
  return (
    <main>
      <Breadcrumbs
        breadcrumbs={[
          { label: 'Invoices', href: '/dashboard/invoices' },
          {
            label: 'Edit Invoice',
            href: `/dashboard/invoices/${id}/edit`,
            active: true,
          },
        ]}
      />
      <Form invoice={invoice} customers={customers} />
    </main>
  );
}

line 16-25 in my buttons.tsx
export function UpdateInvoice({ id }: { id: string }) {
  return (
    <Link
      href={`/dashboard/invoices/${id}/edit`}
      className="rounded-md border p-2 hover:bg-gray-100"
    >
      <PencilIcon className="w-5" />
    </Link>
  );
}


Thank you in advance for anyone who tries to help me I really appreciate you ❤️
Answered by Asian black bear
Problem solved, I had to completely close VsCode and rename the file manually, for some reason in VSCode I was not allowed to change the file name to [id] to create a dynamic pathway and it just kept defaulting to 'id'
View full answer

10 Replies

Asian black bearOP
the final link of text was my table.tsx i don't know why it posted at the bottom as like a file
I have a feeling the issue is with my 'dynamic routes' because when i made the invoices/[id]/edit path the [id] just shows as 'id' on the folder name
it doesn't look like this for me
this is what mine looks like
i get this error every time i try to rename it too
but i am the admin on my local machine so idk
Asian black bearOP
Problem solved, I had to completely close VsCode and rename the file manually, for some reason in VSCode I was not allowed to change the file name to [id] to create a dynamic pathway and it just kept defaulting to 'id'
Answer