From ca9f2f42249776f3d14b29759ef57f97070f623c Mon Sep 17 00:00:00 2001 From: leegwae Date: Wed, 6 Sep 2023 14:22:13 +0900 Subject: [PATCH] =?UTF-8?q?fix(qa-modal):=20=ED=8C=A8=EB=84=90=20=EB=A1=9C?= =?UTF-8?q?=EB=8D=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EA=B0=80=20undefined?= =?UTF-8?q?=EC=9D=B8=20=EA=B2=BD=EC=9A=B0=20=EB=B6=84=EA=B8=B0=ED=95=9C?= =?UTF-8?q?=EB=8B=A4=20(#447)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/panel/QAModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/panel/QAModal.tsx b/src/components/panel/QAModal.tsx index 4a4fd262..f7c2c02e 100644 --- a/src/components/panel/QAModal.tsx +++ b/src/components/panel/QAModal.tsx @@ -40,7 +40,7 @@ export function QAModal({ const userId = useUserStore((state) => state.id); // [NOTE] 질문과 답변 모달은 패널 페이지에서만 사용되므로 // 패널 페이지 로더가 반환하는 데이터가 null이 아님이 보장된다 - const { author, ...panel } = useRouteLoaderData('panel') as Panel; + const panelLoaderData = useRouteLoaderData('panel') as Panel; const now = useCurrentDate(); const answersQuery = useAnswersQuery(questionId); @@ -108,6 +108,10 @@ export function QAModal({ }, }); + if (panelLoaderData === undefined) return <>; + + const { author, ...panel } = panelLoaderData; + // TODO: Fallback UI 제공하기 if (answersQuery.isLoading) return
loading
; if (answersQuery.isError) return
error
;