From e187e1d6737bfe916a52bab5b60c428657f24757 Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 21:38:09 +0000 Subject: [PATCH] fix(search): Handle invalid JSON in localStorage for search platforms --- src/components/search/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/search/index.tsx b/src/components/search/index.tsx index 99cc8371a42fe7..10fdddea0d7fbe 100644 --- a/src/components/search/index.tsx +++ b/src/components/search/index.tsx @@ -99,8 +99,13 @@ export function Search({ searchPlatforms.length === 0 && useStoredSearchPlatforms ) { - const platforms = JSON.parse(storedPlatforms); - setCurrentSearchPlatforms(platforms); + try { + const platforms = JSON.parse(storedPlatforms); + setCurrentSearchPlatforms(platforms); + } catch { + // If the stored value is not valid JSON, reset it + localStorage.removeItem(STORAGE_KEY); + } } }, [useStoredSearchPlatforms, searchPlatforms]);