Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Part of this tutorial was to deploy it out to vercel. It was very slick.I took t
5. [Navigating Between Pages ♻️][2-5]
6. [Setting Up Your Database ♻️][2-6]
7. [Fetching Data ♻️][2-7]
8. Static and Dynamic Rendering 🚧
8. [Static and Dynamic Rendering ♻️][2-8]
9. Streaming 🚧
10. Partial Prerendering ️🚧
11. Adding Search and Pagination 🚧
Expand All @@ -56,4 +56,5 @@ Part of this tutorial was to deploy it out to vercel. It was very slick.I took t
[2-4]: https://github.com/treejamie/next-js-learn/pull/11
[2-5]: https://github.com/treejamie/next-js-learn/pull/12
[2-6]: https://github.com/treejamie/next-js-learn/pull/13
[2-7]: https://github.com/treejamie/next-js-learn/pull/15
[2-7]: https://github.com/treejamie/next-js-learn/pull/15
[2-8]: https://github.com/treejamie/next-js-learn/pull/16
12 changes: 4 additions & 8 deletions app-router/nextjs-dashboard/app/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });

export async function fetchRevenue() {
try {
// Artificially delay a response for demo purposes.
// Don't do this in production :)

// console.log('Fetching revenue data...');
// await new Promise((resolve) => setTimeout(resolve, 3000));
// this is where chapter 8 inserted a delay.
// it was to labour the point that with dynamic rendering
// you can only be as fast as your slowest fetch.

// get the data and return it
const data = await sql<Revenue[]>`SELECT * FROM revenue`;

// console.log('Data fetch completed after 3 seconds.');

return data;
} catch (error) {
console.error('Database Error:', error);
Expand Down