From 553206fa172026f46eb1eae3587d170065145892 Mon Sep 17 00:00:00 2001 From: choiboa Date: Thu, 1 Jan 2026 21:11:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20:=20SSR=20+=20React=20?= =?UTF-8?q?Query=20=ED=95=98=EC=9D=B4=EB=93=9C=EB=A0=88=EC=9D=B4=EC=85=98?= =?UTF-8?q?=20=EB=B2=94=EC=9C=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(protected)/layout.tsx | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/app/(protected)/layout.tsx b/src/app/(protected)/layout.tsx index aef9748..8a056a8 100644 --- a/src/app/(protected)/layout.tsx +++ b/src/app/(protected)/layout.tsx @@ -1,6 +1,9 @@ +import { GoalResponse } from "@/api/types/goal"; import ProtectedContent from "@/app/(protected)/_components/ProtectedContent"; import { AuthUser } from "@/hooks/queries/auth/queryKeys"; +import goalsQueryKeys from "@/hooks/queries/goals/queryKeys"; import { backendFetch } from "@/lib/backend"; +import { dehydrate, HydrationBoundary, QueryClient } from "@tanstack/react-query"; import { redirect } from "next/navigation"; import NavigationDesktop from "./_components/navigation/NavigationDesktop"; @@ -13,6 +16,7 @@ export default async function ProtectedLayout({ children, modal, }: ProtectedLayoutProps) { + const queryClient = new QueryClient(); let user: AuthUser; try { @@ -21,18 +25,25 @@ export default async function ProtectedLayout({ redirect("/login"); } + await queryClient.prefetchQuery({ + queryKey: goalsQueryKeys.list(), + queryFn: () => backendFetch("/goals", { auth: "access" }), + }); + return ( - -
-
- -
+ + +
+
+ +
-
- {children} - {modal} -
-
-
+
+ {children} + {modal} +
+
+
+ ); } From 959a3f6870dd39209b0b088360b2c16ba80d9c69 Mon Sep 17 00:00:00 2001 From: choiboa Date: Thu, 1 Jan 2026 21:18:04 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=A8=20Fix=20:=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EC=BF=BC=EB=A6=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(protected)/goals/[goalId]/page.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/app/(protected)/goals/[goalId]/page.tsx b/src/app/(protected)/goals/[goalId]/page.tsx index ba0cc6c..5d50b0f 100644 --- a/src/app/(protected)/goals/[goalId]/page.tsx +++ b/src/app/(protected)/goals/[goalId]/page.tsx @@ -29,13 +29,6 @@ export default async function GoalsPage({ params }: GoalsPageProps) { auth: "access", }), }), - queryClient.prefetchQuery({ - queryKey: goalsQueryKeys.list(), - queryFn: () => - backendFetch("/goals", { - auth: "access", - }), - }), ]); return (