Skip to content

fix: handle corrupt localStorage values without crashing#186

Open
akarsh-jain-790 wants to merge 1 commit intoNetflix:masterfrom
akarsh-jain-790:bug/localstorage-json-parse-crash
Open

fix: handle corrupt localStorage values without crashing#186
akarsh-jain-790 wants to merge 1 commit intoNetflix:masterfrom
akarsh-jain-790:bug/localstorage-json-parse-crash

Conversation

@akarsh-jain-790
Copy link
Copy Markdown

JSON.parse was called without try/catch on values read from localStorage in two places.

If the stored value is invalid JSON (due to a browser crash, manual edit, or storage corruption), the app throws an unhandled SyntaxError and crashes to a white screen.

  • Home page (home-params): wrap JSON.parse in try/catch, clear the corrupt key so the page loads with default params instead of crashing
  • useTaskListSettings (custom-settings): same fix for the run timeline
  • Home page (localStorage.setItem): wrap in try/catch to handle QuotaExceededError gracefully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant