Summary
In Client/src/App.jsx, JSON.parse(localStorage.getItem("user") || "{}") has no try-catch. Corrupted localStorage data crashes the entire React app on every route.
Details
- File:
Client/src/App.jsx
- No error handling around localStorage deserialization
- Corrupted data (e.g., from a previous app version) throws an uncaught exception
- Also affects: token stored in
localStorage instead of httpOnly cookies
Impact
Any localStorage corruption causes a complete app crash with no recovery. Users may need to manually clear site data to fix it.
Suggested Fix
Wrap in try-catch, default to null on failure, and clear corrupted entries automatically.
Summary
In
Client/src/App.jsx,JSON.parse(localStorage.getItem("user") || "{}")has no try-catch. Corrupted localStorage data crashes the entire React app on every route.Details
Client/src/App.jsxlocalStorageinstead ofhttpOnlycookiesImpact
Any localStorage corruption causes a complete app crash with no recovery. Users may need to manually clear site data to fix it.
Suggested Fix
Wrap in try-catch, default to null on failure, and clear corrupted entries automatically.