From 025d0b2eb6d1bd654492df7a008a771c285fbf5d Mon Sep 17 00:00:00 2001 From: treejamie Date: Wed, 9 Apr 2025 07:39:13 +0100 Subject: [PATCH 1/2] Updated readme.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 135fd29..a0fa470 100644 --- a/README.md +++ b/README.md @@ -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 🚧 @@ -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 \ No newline at end of file +[2-7]: https://github.com/treejamie/next-js-learn/pull/15 +[2-8]: https://github.com/treejamie/next-js-learn/pull/16 \ No newline at end of file From 1c12d5a6e29b1ef41fa6a9d087a684f78538aa47 Mon Sep 17 00:00:00 2001 From: treejamie Date: Wed, 9 Apr 2025 07:47:02 +0100 Subject: [PATCH 2/2] There was little code in this one, it was an exercise in speed and sleep --- app-router/nextjs-dashboard/app/lib/data.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app-router/nextjs-dashboard/app/lib/data.ts b/app-router/nextjs-dashboard/app/lib/data.ts index d9bba04..58698d1 100644 --- a/app-router/nextjs-dashboard/app/lib/data.ts +++ b/app-router/nextjs-dashboard/app/lib/data.ts @@ -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`SELECT * FROM revenue`; - - // console.log('Data fetch completed after 3 seconds.'); - return data; } catch (error) { console.error('Database Error:', error);