From a896c4a642c4a7f6447a8a2cc1905c6746fe48f1 Mon Sep 17 00:00:00 2001 From: notend Date: Fri, 25 Oct 2024 23:46:47 +0800 Subject: [PATCH] feat: update packages --- .prettierignore | 1 - README.md | 1 + app/demos/page.tsx | 4 +- .../_components/client-component.tsx | 2 +- .../_components/prompt-activity.tsx | 4 +- .../_components/rsc-component.tsx | 4 +- app/loading-and-streaming/action.ts | 4 +- app/loading-and-streaming/page.tsx | 4 +- components/ui/breadcrumb.tsx | 2 +- components/ui/button.tsx | 2 +- components/ui/command.tsx | 2 +- components/ui/input.tsx | 2 +- components/ui/toaster.tsx | 2 +- {components/ui => hooks}/use-toast.ts | 56 +- next.config.js => next.config.ts | 9 +- package.json | 73 +- pnpm-lock.yaml | 3674 ++++++++--------- postcss.config.js | 6 - postcss.config.mjs | 9 + tsconfig.json | 2 +- 20 files changed, 1738 insertions(+), 2125 deletions(-) rename {components/ui => hooks}/use-toast.ts (76%) rename next.config.js => next.config.ts (77%) delete mode 100644 postcss.config.js create mode 100644 postcss.config.mjs diff --git a/.prettierignore b/.prettierignore index 8bf18e0..326d9f5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,7 +4,6 @@ package-lock.json public node_modules next-env.d.ts -next.config.ts pnpm-lock.yaml .github .husky diff --git a/README.md b/README.md index 046a699..96f0c5d 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ For Next.js, check this: [Next.js 14 Boilerplate](https://github.com/qinsong77/N - How to test, the test strategy/architecture with RSC - in [table pagination demo](./app/pagination-demo/page.tsx), Suspense fallback will cover table pagination and header when paginate on client, how to show them when request on client - Fixed by using [useTransition](https://19.react.dev/reference/react/useTransition), refer: [Preventing unwanted loading indicators ](https://19.react.dev/reference/react/useTransition#preventing-unwanted-loading-indicators) +- Remove `"react-is": "19.0.0-rc-1631855f-20241023"` in `package.json` for support React 19 ## Best Practices diff --git a/app/demos/page.tsx b/app/demos/page.tsx index 5b3970c..8d93b1e 100644 --- a/app/demos/page.tsx +++ b/app/demos/page.tsx @@ -4,8 +4,8 @@ import { logger } from '@/lib/shared' import { DropDown } from './_components/dropdown' -// This part is important! -export const dynamic = 'force-dynamic' +// This part is important! no need for next 15 +// export const dynamic = 'force-dynamic' const fetchPokemon = async (poke: string) => { if (!poke) return null diff --git a/app/loading-and-streaming/_components/client-component.tsx b/app/loading-and-streaming/_components/client-component.tsx index 13c84ff..e03ec8b 100644 --- a/app/loading-and-streaming/_components/client-component.tsx +++ b/app/loading-and-streaming/_components/client-component.tsx @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react' import { Button } from '@/components/ui/button' import { Separator } from '@/components/ui/separator' import { ToastAction } from '@/components/ui/toast' -import { useToast } from '@/components/ui/use-toast' +import { useToast } from '@/hooks/use-toast' export const ClientComponent = ({ children, diff --git a/app/loading-and-streaming/_components/prompt-activity.tsx b/app/loading-and-streaming/_components/prompt-activity.tsx index e983124..10ebf83 100644 --- a/app/loading-and-streaming/_components/prompt-activity.tsx +++ b/app/loading-and-streaming/_components/prompt-activity.tsx @@ -14,9 +14,7 @@ interface Joke { } async function getRandomJoke(): Promise { logger.info('getRandomJoke start') - const res = await fetch('https://api.chucknorris.io/jokes/random', { - cache: 'no-store', - }) + const res = await fetch('https://api.chucknorris.io/jokes/random') await sleep(1500) if (!res.ok) { diff --git a/app/loading-and-streaming/_components/rsc-component.tsx b/app/loading-and-streaming/_components/rsc-component.tsx index aa29df2..e9fcb51 100644 --- a/app/loading-and-streaming/_components/rsc-component.tsx +++ b/app/loading-and-streaming/_components/rsc-component.tsx @@ -11,9 +11,7 @@ type RES = { async function getEggById(id: number): Promise { logger.info({ id }, 'getEggById start') - const res = await fetch(`https://pokeapi.co/api/v2/egg-group/${id}`, { - cache: 'no-store', - }) + const res = await fetch(`https://pokeapi.co/api/v2/egg-group/${id}`) await sleep(1500) if (!res.ok) { diff --git a/app/loading-and-streaming/action.ts b/app/loading-and-streaming/action.ts index 8443ce9..8589444 100644 --- a/app/loading-and-streaming/action.ts +++ b/app/loading-and-streaming/action.ts @@ -18,9 +18,7 @@ export type EggGroup = { export async function getEggGroup(): Promise { logger.info('getEggGroup start') - const res = await fetch('https://pokeapi.co/api/v2/egg-group', { - cache: 'no-store', - }) + const res = await fetch('https://pokeapi.co/api/v2/egg-group') await sleep(3000) if (!res.ok) { // This will activate the closest `error.js` Error Boundary diff --git a/app/loading-and-streaming/page.tsx b/app/loading-and-streaming/page.tsx index 918d11e..d6a4e27 100644 --- a/app/loading-and-streaming/page.tsx +++ b/app/loading-and-streaming/page.tsx @@ -32,9 +32,7 @@ type Res = { } async function getUserInfo(): Promise { logger.info('getUserInfo starting ') - const res = await fetch('https://randomuser.me/api/', { - cache: 'no-store', - }) + const res = await fetch('https://randomuser.me/api/') await sleep(1000) logger.info(res, 'getUserInfo done') diff --git a/components/ui/breadcrumb.tsx b/components/ui/breadcrumb.tsx index 71a5c32..60e6c96 100644 --- a/components/ui/breadcrumb.tsx +++ b/components/ui/breadcrumb.tsx @@ -80,7 +80,7 @@ const BreadcrumbSeparator = ({