Skip to content

fix: handle corrupt localStorage bookmarks in Matchmaker#574

Open
saurabhhhcodes wants to merge 1 commit into
indresh404:mainfrom
saurabhhhcodes:fix/matchmaker-bookmarks-corruption-566
Open

fix: handle corrupt localStorage bookmarks in Matchmaker#574
saurabhhhcodes wants to merge 1 commit into
indresh404:mainfrom
saurabhhhcodes:fix/matchmaker-bookmarks-corruption-566

Conversation

@saurabhhhcodes

Copy link
Copy Markdown

Fixes #566

Root cause

JSON.parse(cached) in the useState lazy initializer throws a synchronous SyntaxError when localStorage data is malformed (browser extension, quota error mid-write, etc.), crashing the entire Matchmaker page.

Changes

  • Safe loading — wrapped JSON.parse in try/catch with corrupt entry purging
  • Guest-to-user migration — on login, guest bookmarks are migrated to the user-specific key
  • Storage write protection — wrapped localStorage.setItem in try/catch for quota errors

No behavior change for normal usage; only adds resilience against corrupt storage state.

)

- Wrap JSON.parse in try/catch to prevent SyntaxError crash
- Purge corrupt entries on parse failure
- Add guest-to-user bookmark migration on login
- Wrap setItem in try/catch for storage quota errors
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 17, 2026 7:29am

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Matchmaker crashes with uncaught SyntaxError when localStorage bookmark data is corrupted

1 participant