next14 learn invoice type error
Unanswered
Spectacled bear posted this in #help-forum
Spectacled bearOP
import Form from '@/app/ui/invoices/edit-form';
import Breadcrumbs from '@/app/ui/invoices/breadcrumbs';
import { fetchCustomers, fetchInvoiceById } from '@/app/lib/data';
import { InvoiceForm } from '@/app/lib/definitions';
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,
},
]}
/>
{invoice ?
(<Form invoice={invoice} customers={customers} />) :
(<h3>There is no invoice with that id</h3>)}
</main>
6 Replies
Spectacled bearOP
@Asian black bear
Asian black bear
And what's the error?
Spectacled bearOP
its returning me an undefined, so it doesnt show me the actual form, even tho that invoice actually exists
Asian black bear
You mean the value of
invoice
is undefined
during runtime for a particular id
where you'd expect it not to be?Spectacled bearOP
i fixed it, it was an error with the query
but idk why i need to validate this in the first place, its straight out of the docs lol