From c5af4f8cfb039c2110b15e6ed779da12162a590f Mon Sep 17 00:00:00 2001 From: StephDietz Date: Thu, 26 Oct 2023 09:23:13 -0700 Subject: [PATCH 1/4] chapter 5 --- .../starter-example/app/ui/dashboard/nav-links.tsx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dashboard/starter-example/app/ui/dashboard/nav-links.tsx b/dashboard/starter-example/app/ui/dashboard/nav-links.tsx index 338b1c5..f2a67eb 100644 --- a/dashboard/starter-example/app/ui/dashboard/nav-links.tsx +++ b/dashboard/starter-example/app/ui/dashboard/nav-links.tsx @@ -1,12 +1,8 @@ -'use client'; - import { UserGroupIcon, HomeIcon, DocumentDuplicateIcon, } from '@heroicons/react/24/outline'; -import Link from 'next/link'; -import { usePathname } from 'next/navigation'; import clsx from 'clsx'; // Map of links to display in the side navigation. @@ -22,26 +18,21 @@ const links = [ ]; export default function NavLinks() { - const pathname = usePathname(); - return ( <> {links.map((link) => { const LinkIcon = link.icon; return ( -

{link.name}

- + ); })} From 61d291649bdfcfe9c99371b1a0d562d21bdb4395 Mon Sep 17 00:00:00 2001 From: StephDietz Date: Thu, 26 Oct 2023 09:24:32 -0700 Subject: [PATCH 2/4] chapter 6 --- dashboard/starter-example/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/dashboard/starter-example/package.json b/dashboard/starter-example/package.json index d1223b8..0b7c12b 100644 --- a/dashboard/starter-example/package.json +++ b/dashboard/starter-example/package.json @@ -3,7 +3,6 @@ "scripts": { "build": "next build", "dev": "next dev", - "seed": "node -r dotenv/config ./scripts/seed.js", "start": "next start" }, "dependencies": { From ad6ef574e786c6a7776e04ce7f999cb7045a1804 Mon Sep 17 00:00:00 2001 From: StephDietz Date: Thu, 26 Oct 2023 09:30:41 -0700 Subject: [PATCH 3/4] chapter 7 --- dashboard/starter-example/app/ui/dashboard/cards.tsx | 8 -------- .../starter-example/app/ui/dashboard/latest-invoices.tsx | 3 --- .../starter-example/app/ui/dashboard/revenue-chart.tsx | 3 --- 3 files changed, 14 deletions(-) diff --git a/dashboard/starter-example/app/ui/dashboard/cards.tsx b/dashboard/starter-example/app/ui/dashboard/cards.tsx index 10fadb4..adf10ac 100644 --- a/dashboard/starter-example/app/ui/dashboard/cards.tsx +++ b/dashboard/starter-example/app/ui/dashboard/cards.tsx @@ -5,7 +5,6 @@ import { InboxIcon, } from '@heroicons/react/24/outline'; import { lusitana } from '@/app/ui/fonts'; -import { fetchCardData } from '@/app/lib/data'; const iconMap = { collected: BanknotesIcon, @@ -15,13 +14,6 @@ const iconMap = { }; export default async function Cards() { - const { - numberOfInvoices, - numberOfCustomers, - totalPaidInvoices, - totalPendingInvoices, - } = await fetchCardData(); - return ( <> diff --git a/dashboard/starter-example/app/ui/dashboard/latest-invoices.tsx b/dashboard/starter-example/app/ui/dashboard/latest-invoices.tsx index 14262c9..9e25e4e 100644 --- a/dashboard/starter-example/app/ui/dashboard/latest-invoices.tsx +++ b/dashboard/starter-example/app/ui/dashboard/latest-invoices.tsx @@ -2,10 +2,7 @@ import { ArrowPathIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; import Image from 'next/image'; import { lusitana } from '@/app/ui/fonts'; -import { fetchLatestInvoices } from '@/app/lib/data'; export default async function LatestInvoices() { - const latestInvoices = await fetchLatestInvoices(); - return (

diff --git a/dashboard/starter-example/app/ui/dashboard/revenue-chart.tsx b/dashboard/starter-example/app/ui/dashboard/revenue-chart.tsx index 63b4726..1305358 100644 --- a/dashboard/starter-example/app/ui/dashboard/revenue-chart.tsx +++ b/dashboard/starter-example/app/ui/dashboard/revenue-chart.tsx @@ -1,7 +1,6 @@ import { generateYAxis } from '@/app/lib/utils'; import { CalendarIcon } from '@heroicons/react/24/outline'; import { lusitana } from '@/app/ui/fonts'; -import { fetchRevenue } from '@/app/lib/data'; // This component is representational only. // For data visualization UI, check out: @@ -10,8 +9,6 @@ import { fetchRevenue } from '@/app/lib/data'; // https://airbnb.io/visx/ export default async function RevenueChart() { - const revenue = await fetchRevenue(); - const chartHeight = 350; const { yAxisLabels, topLabel } = generateYAxis(revenue); From 266ebb124ba220da6f9cd8bb4310205fa2779751 Mon Sep 17 00:00:00 2001 From: StephDietz Date: Thu, 26 Oct 2023 09:34:15 -0700 Subject: [PATCH 4/4] chapter 8 --- dashboard/starter-example/app/lib/data.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dashboard/starter-example/app/lib/data.ts b/dashboard/starter-example/app/lib/data.ts index 6704fe9..c9009d0 100644 --- a/dashboard/starter-example/app/lib/data.ts +++ b/dashboard/starter-example/app/lib/data.ts @@ -9,12 +9,11 @@ import { Revenue, } from './definitions'; import { formatCurrency } from './utils'; -import { unstable_noStore as noStore } from 'next/cache'; export async function fetchRevenue() { // Add noStore() here prevent the response from being cached. // This is equivalent to in fetch(..., {cache: 'no-store'}). - noStore(); + try { // Artificially delay a reponse for demo purposes. // Don't do this in real life :) @@ -34,7 +33,6 @@ export async function fetchRevenue() { } export async function fetchLatestInvoices() { - noStore(); try { const data = await sql` SELECT invoices.amount, customers.name, customers.image_url, customers.email, invoices.id @@ -55,7 +53,6 @@ export async function fetchLatestInvoices() { } export async function fetchCardData() { - noStore(); try { // You can probably combine these into a single SQL query // However, we are intentionally splitting them to demonstrate @@ -95,7 +92,6 @@ export async function fetchFilteredInvoices( query: string, currentPage: number, ) { - noStore(); const offset = (currentPage - 1) * ITEMS_PER_PAGE; try { @@ -128,7 +124,6 @@ export async function fetchFilteredInvoices( } export async function fetchInvoicesPages(query: string) { - noStore(); try { const count = await sql`SELECT COUNT(*) FROM invoices @@ -193,7 +188,6 @@ export async function fetchCustomers() { } export async function fetchFilteredCustomers(query: string) { - noStore(); try { const data = await sql` SELECT