Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(ui): validate stored resizable-panel layout before handing it to react-resizable-panels (#50349)

claude[bot]bd95407a9c98
diff --git a/packages/ui/src/components/shadcn/ui/resizable.tsx b/packages/ui/src/components/shadcn/ui/resizable.tsx
index 71f25d039da..e9ab2084287 100644
--- a/packages/ui/src/components/shadcn/ui/resizable.tsx
+++ b/packages/ui/src/components/shadcn/ui/resizable.tsx
@@ -16,7 +16,12 @@ const serverCompatibleLocalStorage = {
getItem: (k: string) => {
if (typeof window === 'undefined') return null
try {
- return localStorage.getItem(transformLayoutKey(k))
+ const value = localStorage.getItem(transformLayoutKey(k))
+ if (value === null) return null
+ // react-resizable-panels JSON.parses this value itself with no guard;
+ // validate here so a corrupted value falls back to null instead of crashing.
+ JSON.parse(value)
+ return value
} catch {
return null
}