Skip to content

Commit dd46dca

Browse files
authored
Merge pull request #24 from database-playground/next-16
chore: upgrade to Next.js v16
2 parents b430db4 + c16b42d commit dd46dca

File tree

9 files changed

+722
-689
lines changed

9 files changed

+722
-689
lines changed

app/(admin)/(user-management)/users/_components/update-form.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { UpdateFormBody } from "@/components/update-modal/form-body";
66
import type { UpdateFormBaseProps } from "@/components/update-modal/types";
77
import { zodResolver } from "@hookform/resolvers/zod";
88
import React from "react";
9-
import { useForm } from "react-hook-form";
9+
import { useForm, useWatch } from "react-hook-form";
1010
import { z } from "zod";
1111

1212
export const formSchema = z.object({
@@ -39,6 +39,9 @@ export function UpdateUserForm({
3939
defaultValues,
4040
});
4141

42+
const avatar = useWatch({ control: form.control, name: "avatar" });
43+
const name = useWatch({ control: form.control, name: "name" });
44+
4245
const handleSubmit = (data: z.infer<typeof formSchema>) => {
4346
onSubmit({
4447
name: data.name,
@@ -85,8 +88,8 @@ export function UpdateUserForm({
8588
/>
8689

8790
<Avatar>
88-
<AvatarImage src={form.watch("avatar")} />
89-
<AvatarFallback>{form.watch("name")}</AvatarFallback>
91+
<AvatarImage src={avatar} />
92+
<AvatarFallback>{name}</AvatarFallback>
9093
</Avatar>
9194
</div>
9295

app/(admin)/layout.tsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,34 @@ import { AppSidebar } from "@/components/app-sidebar";
22
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
33
import AuthorizedApolloWrapper from "@/providers/use-apollo.rsc";
44
import ProtectedRoute from "@/providers/use-protected-route";
5-
import { unstable_ViewTransition as ViewTransition } from "react";
5+
import { Suspense, ViewTransition } from "react";
66

77
export default function AdminLayout({
88
children,
99
}: Readonly<{
1010
children: React.ReactNode;
1111
}>) {
1212
return (
13-
<ProtectedRoute>
14-
<AuthorizedApolloWrapper>
15-
<SidebarProvider
16-
style={{
17-
"--sidebar-width": "calc(var(--spacing) * 72)",
18-
"--header-height": "calc(var(--spacing) * 12)",
19-
} as React.CSSProperties}
20-
>
21-
<AppSidebar variant="inset" />
22-
<SidebarInset>
23-
<ViewTransition>
24-
<div suppressHydrationWarning>
25-
{children}
26-
</div>
27-
</ViewTransition>
28-
</SidebarInset>
29-
</SidebarProvider>
30-
</AuthorizedApolloWrapper>
31-
</ProtectedRoute>
13+
<Suspense>
14+
<ProtectedRoute>
15+
<AuthorizedApolloWrapper>
16+
<SidebarProvider
17+
style={{
18+
"--sidebar-width": "calc(var(--spacing) * 72)",
19+
"--header-height": "calc(var(--spacing) * 12)",
20+
} as React.CSSProperties}
21+
>
22+
<AppSidebar variant="inset" />
23+
<SidebarInset>
24+
<ViewTransition>
25+
<div suppressHydrationWarning>
26+
{children}
27+
</div>
28+
</ViewTransition>
29+
</SidebarInset>
30+
</SidebarProvider>
31+
</AuthorizedApolloWrapper>
32+
</ProtectedRoute>
33+
</Suspense>
3234
);
3335
}

app/(admin)/me/_components/form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useUser } from "@/providers/use-user";
99
import { useMutation } from "@apollo/client/react";
1010
import { zodResolver } from "@hookform/resolvers/zod";
1111
import { useEffect } from "react";
12-
import { useForm } from "react-hook-form";
12+
import { useForm, useWatch } from "react-hook-form";
1313
import { toast } from "sonner";
1414
import { z } from "zod";
1515
import { ME_UPDATE_MUTATION } from "./mutation";
@@ -30,6 +30,8 @@ export function MeForm() {
3030
},
3131
});
3232

33+
const avatar = useWatch({ control: form.control, name: "avatar" });
34+
3335
useEffect(() => {
3436
if (!form.formState.isDirty) return;
3537
const message = "您有尚未儲存的更動。確定要關閉而不儲存嗎?您的更動將會遺失。";
@@ -47,8 +49,6 @@ export function MeForm() {
4749
};
4850
}, [form.formState.isDirty]);
4951

50-
const avatar = form.watch("avatar");
51-
5252
const [updateMe] = useMutation(ME_UPDATE_MUTATION, {
5353
refetchQueries: [BASIC_USER_INFO_QUERY],
5454
onError: (error) => {

components/data-table/general.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export function GeneralDataTable<TData, TValue>({
1212
columns,
1313
data,
1414
}: GeneralDataTableProps<TData, TValue>) {
15+
"use no memo";
16+
1517
const table = useReactTable({
1618
data,
1719
columns,

components/ui/sidebar.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,6 @@ function SidebarMenuSkeleton({
723723
}: React.ComponentProps<"div"> & {
724724
showIcon?: boolean;
725725
}) {
726-
// Random width between 50 to 90%.
727-
const width = React.useMemo(() => {
728-
return `${Math.floor(Math.random() * 40) + 50}%`;
729-
}, []);
730-
731726
return (
732727
<div
733728
data-slot="sidebar-menu-skeleton"
@@ -745,7 +740,7 @@ function SidebarMenuSkeleton({
745740
className="h-4 max-w-(--skeleton-width) flex-1"
746741
data-sidebar="menu-skeleton-text"
747742
style={{
748-
"--skeleton-width": width,
743+
"--skeleton-width": "90%",
749744
} as React.CSSProperties}
750745
/>
751746
</div>

next.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ const nextConfig: NextConfig = {
99
swcPlugins: [
1010
["@swc-contrib/plugin-graphql-codegen-client-preset", { artifactDirectory: "./gql", gqlTagName: "graphql" }],
1111
],
12-
ppr: "incremental",
12+
cacheComponents: true,
1313
authInterrupts: true,
14+
turbopackFileSystemCacheForDev: true,
1415
},
1516
};
1617

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "next dev --turbopack",
7+
"dev": "next dev --experimental-https",
88
"build": "next build",
99
"start": "next start",
1010
"lint": "eslint .",
@@ -17,7 +17,7 @@
1717
"@apollo/client": "4.0.7",
1818
"@apollo/client-integration-nextjs": "^0.13.2",
1919
"@bprogress/next": "^3.2.12",
20-
"@graphql-codegen/client-preset": "^5.0.3",
20+
"@graphql-codegen/client-preset": "^5.1.0",
2121
"@hookform/resolvers": "^5.2.2",
2222
"@radix-ui/react-alert-dialog": "^1.1.15",
2323
"@radix-ui/react-avatar": "^1.1.10",
@@ -37,18 +37,18 @@
3737
"class-variance-authority": "^0.7.1",
3838
"clsx": "^2.1.1",
3939
"graphql": "^16.11.0",
40-
"lucide-react": "^0.544.0",
41-
"next": "15.6.0-canary.45",
40+
"lucide-react": "^0.545.0",
41+
"next": "16.0.0-canary.2",
4242
"next-themes": "^0.4.6",
43-
"react": "19.3.0-canary-4fdf7cf2-20251003",
44-
"react-dom": "19.3.0-canary-4fdf7cf2-20251003",
45-
"react-hook-form": "^7.64.0",
43+
"react": "19.3.0-canary-ead92181-20251010",
44+
"react-dom": "19.3.0-canary-ead92181-20251010",
45+
"react-hook-form": "^7.65.0",
4646
"react-remark": "^2.1.0",
4747
"remark": "^15.0.1",
4848
"remark-html": "^16.0.1",
4949
"sonner": "^2.0.7",
5050
"tailwind-merge": "^3.3.1",
51-
"zod": "^4.1.11"
51+
"zod": "^4.1.12"
5252
},
5353
"devDependencies": {
5454
"@0no-co/graphqlsp": "^1.15.0",
@@ -58,13 +58,13 @@
5858
"@graphql-typed-document-node/core": "^3.2.0",
5959
"@parcel/watcher": "^2.5.1",
6060
"@tailwindcss/postcss": "^4.1.14",
61-
"@types/node": "^24.7.0",
62-
"@types/react": "^19.2.0",
63-
"@types/react-dom": "^19.2.0",
64-
"@typescript-eslint/parser": "^8.45.0",
61+
"@types/node": "^24.7.2",
62+
"@types/react": "^19.2.2",
63+
"@types/react-dom": "^19.2.1",
64+
"@typescript-eslint/parser": "^8.46.0",
6565
"dprint": "^0.50.2",
6666
"eslint": "^9.37.0",
67-
"eslint-config-next": "15.6.0-canary.45",
67+
"eslint-config-next": "16.0.0-canary.2",
6868
"eslint-plugin-better-tailwindcss": "^3.7.9",
6969
"tailwindcss": "^4.1.14",
7070
"tw-animate-css": "^1.4.0",

0 commit comments

Comments
 (0)