diff --git a/.changeset/nervous-trees-talk.md b/.changeset/nervous-trees-talk.md new file mode 100644 index 00000000..305f9546 --- /dev/null +++ b/.changeset/nervous-trees-talk.md @@ -0,0 +1,7 @@ +--- +"eslint-config-custom": patch +"usehooks-ts": patch +"www": patch +--- + +Add React 19 support diff --git a/.vscode/settings.json b/.vscode/settings.json index 0ba33894..388ec40f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -74,5 +74,6 @@ "[typescriptreact]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }, - "files.associations": { "*.json": "jsonc" } + "files.associations": { "*.json": "jsonc" }, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/apps/www/package.json b/apps/www/package.json index 10f8026e..d1f91025 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -13,26 +13,26 @@ "generate-doc": "cd ../.. && pnpm generate-doc && cd -" }, "dependencies": { - "@next/third-parties": "^14.1.0", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-dropdown-menu": "^2.0.6", - "@radix-ui/react-slot": "^1.0.2", - "@t3-oss/env-nextjs": "^0.9.2", + "@next/third-parties": "^15.1.2", + "@radix-ui/react-dialog": "^1.1.4", + "@radix-ui/react-dropdown-menu": "^2.1.4", + "@radix-ui/react-slot": "^1.1.1", + "@t3-oss/env-nextjs": "^0.11.1", "@types/voca": "^1.4.1", "algoliasearch": "^4.22.1", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", - "cmdk": "^1.0.0", + "cmdk": "^1.0.4", "date-fns": "^3.3.1", "gray-matter": "^4.0.3", - "lucide-react": "^0.364.0", - "next": "14.1.4", - "next-mdx-remote": "^4.4.1", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-instantsearch": "^7.6.0", + "lucide-react": "^0.469.0", + "next": "15.1.2", + "next-mdx-remote": "^5.0.0", + "react": "19.0.0", + "react-dom": "19.0.0", + "react-instantsearch": "^7.13.9", "rehype-prism-plus": "^2.0.0", - "remark-gfm": "^3.0.1", + "remark-gfm": "^4.0.0", "schema-dts": "^1.1.2", "tailwind-merge": "^2.2.1", "tailwindcss": "3.4.3", @@ -45,13 +45,12 @@ "@tailwindcss/line-clamp": "^0.4.4", "@tailwindcss/typography": "^0.5.10", "@types/node": "20.12.2", - "@types/react": "18.2.73", - "@types/react-dom": "18.2.23", + "@types/react": "19.0.2", + "@types/react-dom": "19.0.2", "autoprefixer": "10.4.19", "eslint-config-custom": "workspace:*", "eslint-config-next": "14.1.4", "next-sitemap": "^4.2.3", - "postcss": "8.4.38", - "typescript": "5.4.3" + "postcss": "8.4.38" } } diff --git a/apps/www/src/app/(docs)/react-hook/[slug]/page.tsx b/apps/www/src/app/(docs)/react-hook/[slug]/page.tsx index 7505399a..034e35a0 100644 --- a/apps/www/src/app/(docs)/react-hook/[slug]/page.tsx +++ b/apps/www/src/app/(docs)/react-hook/[slug]/page.tsx @@ -7,6 +7,8 @@ import { RightSidebar } from '@/components/docs/right-sidebar' import { siteConfig } from '@/config/site' import { getHook, getHookList } from '@/lib/api' +type Params = Promise<{ slug: string }> + export const generateStaticParams = async () => { const hooks = await getHookList() return hooks.map(hook => ({ slug: hook.slug })) @@ -24,11 +26,14 @@ function getImageUrl(name: string) { return `https://via.placeholder.com/1200x630.png/007ACC/fff/?text=${name}` } -export const generateMetadata = async (props: { - params: { slug: string } +export const generateMetadata = async ({ + params, +}: { + params: Params }): Promise => { + const { slug } = await params const hooks = await getHookList() - const hook = hooks.find(hook => hook.slug === props.params.slug) + const hook = hooks.find(hook => hook.slug === slug) if (!hook) { return {} } @@ -63,13 +68,10 @@ export const generateMetadata = async (props: { } } -export default async function HookPage({ - params, -}: { - params: { slug: string } -}) { +export default async function HookPage({ params }: { params: Params }) { + const { slug } = await params const [{ frontmatter, content }, hookList] = await Promise.all([ - getHook(params.slug), + getHook(slug), getHookList(), ]) diff --git a/apps/www/src/components/docs/table-of-content.tsx b/apps/www/src/components/docs/table-of-content.tsx index 0ebbcb24..e6200e29 100644 --- a/apps/www/src/components/docs/table-of-content.tsx +++ b/apps/www/src/components/docs/table-of-content.tsx @@ -107,7 +107,7 @@ function Tree({ tree, level = 1, activeItem }: TreeProps) { href={item.url} className={cn( 'inline-block no-underline', - item.url === `#${activeItem}` + item.url === `#${activeItem ?? ''}` ? 'font-medium text-primary' : 'text-sm text-muted-foreground', )} diff --git a/apps/www/src/components/main-nav.tsx b/apps/www/src/components/main-nav.tsx index 05f29c88..99df32bd 100644 --- a/apps/www/src/components/main-nav.tsx +++ b/apps/www/src/components/main-nav.tsx @@ -28,7 +28,7 @@ export function MainNav({ items, children }: MainNavProps) { {siteConfig.name} - {items?.length ? ( + {items?.length && segment ? (