From 4a08dded14b8fa2db1d575a93c28a36a124da438 Mon Sep 17 00:00:00 2001 From: jisangs Date: Tue, 26 May 2026 15:29:50 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(game)/play/PlayClient.tsx | 8 ++++---- app/(game)/play/page.tsx | 8 ++++++-- app/page.tsx | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/(game)/play/PlayClient.tsx b/app/(game)/play/PlayClient.tsx index 05e9736..a650cd7 100644 --- a/app/(game)/play/PlayClient.tsx +++ b/app/(game)/play/PlayClient.tsx @@ -38,13 +38,13 @@ export default function PlayClient({ problemCount }: PlayClientProps) { const [answerB, setAnswerB] = useState(""); const [inputError, setInputError] = useState(""); + const sessionProblemCount = session?.problems.length ?? null; const currentProblem = session?.problems[session.currentIndex] ?? null; const currentResult = session?.results[session.currentIndex] ?? null; const isComplete = Boolean( session && session.currentIndex >= session.problems.length, ); - const sessionNeedsInit = - session === null || session.problems.length !== problemCount; + const sessionNeedsInit = sessionProblemCount !== problemCount; const correctCount = session?.results.filter((result) => result?.correct).length ?? 0; const totalCount = session?.problems.length ?? 0; @@ -61,7 +61,7 @@ export default function PlayClient({ problemCount }: PlayClientProps) { initSession, problemCount, selectedProblemCount, - session, + sessionProblemCount, sessionNeedsInit, setProblemCount, ]); @@ -89,7 +89,7 @@ export default function PlayClient({ problemCount }: PlayClientProps) { submitAnswer({ a: parsedA, b: parsedB }); } - if (sessionNeedsInit) { + if (!session || sessionNeedsInit) { return (
diff --git a/app/(game)/play/page.tsx b/app/(game)/play/page.tsx index c1becd5..852ea12 100644 --- a/app/(game)/play/page.tsx +++ b/app/(game)/play/page.tsx @@ -3,11 +3,15 @@ import type { ProblemCount } from "@/store/gameStore"; interface PlayPageProps { searchParams?: { - count?: string; + count?: string | string[]; }; } -function parseProblemCount(count?: string): ProblemCount { +function parseProblemCount(count?: string | string[]): ProblemCount { + if (Array.isArray(count)) { + return parseProblemCount(count[0]); + } + return count === "5" ? 5 : 10; } diff --git a/app/page.tsx b/app/page.tsx index 836d737..48be922 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,7 +6,7 @@ export default function Home() {

- 중학교 2학년 수학 실수 유형 연습 + 중학교 2학년 수학 - 괄호 풀기 연습

괄호 음수 분배 연습