mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## Summary - `serverCompatibleLocalStorage.getItem()` already guards against localStorage access itself throwing (SSR, private browsing, sandboxed iframes), but returns whatever string is stored without checking it's valid JSON. - `react-resizable-panels`' own `useDefaultLayout()` calls `JSON.parse()` on that value with no try/catch, so a stored value that isn't valid JSON (overwritten by another script sharing the origin, a browser extension, or a leftover value from a previous format) throws and crashes the whole panel group instead of falling back to the default layout. - Fix: validate the value is parseable JSON in `getItem()` itself (matching the file's existing best-effort persistence philosophy) and return `null` — same as a missing value — when it isn't. ## Evidence (Sentry, past week) - [SUPABASE-APP-KA8](https://supabase.sentry.io/issues/7726278966/) — `SyntaxError: Unexpected token 'K', "KV-OK" is not valid JSON`, full-page crash via `globalErrorBoundary` on `/project/[ref]/sql/[id]`. ## Test plan - [ ] Manually confirmed the existing `transformLayoutKey`/try-catch behavior for a missing or inaccessible key is unchanged - [ ] Considered adding a unit test for `serverCompatibleLocalStorage.getItem()`, but it isn't currently exported; happy to export it and add a test if reviewers want one 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RUrmUfMBpPqkgerh9onNTM --- _Generated by [Claude Code](https://claude.ai/code/session_01RUrmUfMBpPqkgerh9onNTM)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ali Waseem <waseema393@gmail.com>