-
Notifications
You must be signed in to change notification settings - Fork 230
Fix: added graceful error handling on recover project #931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
afaik the failed checks are due to internal server errors unrelated to the code itself. |
|
Hey @Audatic07 could you push an empty commit to rerun those CI checks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/simulator/src/data/project.ts`:
- Around line 48-51: When load(data) throws inside the catch block, the recovery
entry in localStorage (key "recover") is not cleared, causing repeated failed
recovery attempts; update the catch block in project.ts to remove the recovery
data (localStorage.removeItem('recover')) and then show the existing error
handling (showError and console.error) so the user can escape the retry loop —
reference the catch around load(data) and the "recover" key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/simulator/src/data/project.ts`:
- Around line 53-55: The current else branch immediately calls
localStorage.removeItem('recover') which permanently deletes recovery data when
the user clicks "No"; change the logic so that recovery data is not removed on a
simple decline — move localStorage.removeItem('recover') into the confirmed
"Yes" path (the handler that processes a positive confirmation) or replace the
"No" branch with a clear irreversible-warning flow that requires an explicit
user action to delete; update the confirmation handler in the same module (the
function that currently shows the confirmation and uses
localStorage.removeItem('recover')) so deletion only occurs after explicit
consent.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
11c44bb to
94e671d
Compare
|
@Nihal4777 ci is green, please review :) |
|
Tested locally , simulator is not freezing and can be interacted |

Fixes #927
Describe the changes you have made in this PR -
Added graceful error handling on recover project, by handling various edge cases
Screenshots of the UI changes (If any) -
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
When using Recover project during development, the simulator crashes. This is because there was no proper error handling in various edge cases of corrupted/missing data. Now, multiple error handling edge cases have been added and tested. This will not enable projects to be restored correctly in local dev, since this is just the front end, but it will atleast not let the simulator crash.
I tried to somehow get the project to save in local dev, but it was getting too out of scope so I settled with error handling.
This is the simplest approach that works without problems.
First, it checks whether data exists
then it checks whether the data was corrupted/malformed or not
then it checks whether the previous project had valid circuits
Uses fallback value instead of displaying "undefined" to user
Protects against failures in load function itself.
This helps reviewers understand your thought process and ensures you understand the code.
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.
Summary by CodeRabbit
Bug Fixes
Improvements