Skip to content

Fix: Handle localStorage crash on certain operations #4703#4704

Merged
walterbender merged 2 commits intosugarlabs:masterfrom
rakesh0x:StorageIssue
Jun 9, 2025
Merged

Fix: Handle localStorage crash on certain operations #4703#4704
walterbender merged 2 commits intosugarlabs:masterfrom
rakesh0x:StorageIssue

Conversation

@rakesh0x
Copy link
Contributor

@rakesh0x rakesh0x commented Jun 9, 2025

Problem
The application crashes in environments where localStorage is not available or fails (e.g., private mode, low disk space, or security-restricted environments). This leads to unhandled exceptions and breaks the user experience.

Fix
now , its just checks whether the saved data wasn't saved at all(i.e., null or missing ). it avoids unnecessary crashes from minor byte difference and focus on actual failure cases

Files Modified
planet/js/ProjectStorage.js

Testing
Tested in environments with restricted storage and confirmed that the application no longer crashes. Warnings are logged but functionality continues smoothly.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2025

✅ All Jest tests passed! This PR is ready to merge.

@rakesh0x
Copy link
Contributor Author

rakesh0x commented Jun 9, 2025

hey @walterbender , i have separated the pr altogether,
will you please review it now

throw new Error("Not enough space to save locally");
// prevent unnecessary crashing

if(savedjsonob == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space after the if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2025

✅ All Jest tests passed! This PR is ready to merge.

@walterbender walterbender merged commit 6df50f6 into sugarlabs:master Jun 9, 2025
5 checks passed
@rakesh0x rakesh0x deleted the StorageIssue branch June 12, 2025 03:56
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.

2 participants