Next.js Discord

Discord Forum

Streaming in Dashboard tutorial

Unanswered
djphinesse posted this in #help-forum
Open in Discord
In order for streaming to work for the latest invoices component, you need to added this to the function:

export async function fetchLatestInvoices() {
try {
add this line console.log("Fetching invoice data...");

add this line await new Promise((resolve) => setTimeout(resolve, 3000));

const data = await sql<LatestInvoiceRaw[]>SELECT invoices.amount, customers.name, customers.image_url, customers.email, invoices.id FROM invoices JOIN customers ON invoices.customer_id = customers.id ORDER BY invoices.date DESC LIMIT 5;

add this line console.log("Data fetch completed after 3 seconds.");

The tutorial does it for the fetchRevenue function but when are asked to do it yourself, it doesn't make mention of it.

Just in case some newbies were wondering why it wasn't working. Cause I was, lol.

0 Replies