https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42189

--- Comment #46 from Paul Derscheid <[email protected]> ---
Created attachment 198932
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198932&action=edit
Bug 42189: (follow-up) Guard localStorage JSON.parse against corrupt data

- Wrap JSON.parse in try/catch in onMounted so corrupt or stale
  localStorage does not abort dashboard initialization
- On parse failure, remove the bad key and fall through to the
  default layout instead of leaving the dashboard empty
- Apply the same guard in onWidgetRegistered event handler

To test:
- Set localStorage "dashboard-widgets" to invalid JSON (e.g. "{bad")
- Load the ERM dashboard
- Verify widgets render with default layout instead of a blank page
- Verify localStorage is cleaned up after the failed parse

Signed-off-by: Clemens Tubach <[email protected]>
Signed-off-by: Thomas Klausner <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to