From 2a40827f4747b3dc07f534dbdcda054d90afebfe Mon Sep 17 00:00:00 2001 From: MaryWylde Date: Mon, 13 Jul 2026 10:21:13 +0200 Subject: [PATCH] fix(vibesuite): prevent logged-in crash when learnedSkills is not an array The progress-hydration effect iterated accountData.learnedSkills with for...of, guarded only by `?? []`, which catches null/undefined but not other non-array shapes returned by /api/users/me. A non-iterable value threw "is not iterable" during render, blanking the whole page for logged-in users while guests (accountData null) were unaffected. Guard with Array.isArray so only real arrays are hydrated. Co-Authored-By: Claude Opus 4.7 --- src/components/vibesuite/MapClient/MapClient.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/vibesuite/MapClient/MapClient.tsx b/src/components/vibesuite/MapClient/MapClient.tsx index 65deef8d..34569e22 100644 --- a/src/components/vibesuite/MapClient/MapClient.tsx +++ b/src/components/vibesuite/MapClient/MapClient.tsx @@ -70,7 +70,9 @@ export default function MapClient({ const [showScrollTop, setShowScrollTop] = useState(false); useEffect(() => { - const learned: string[] = accountData?.learnedSkills ?? []; + const learned: string[] = Array.isArray(accountData?.learnedSkills) + ? accountData.learnedSkills + : []; if (learned.length === 0) return; const hydrated: UserProgress = {}; for (const id of learned) {