Improve query history localStorage recovery handling#930
Improve query history localStorage recovery handling#930shivambind269-ai wants to merge 3 commits into
Conversation
|
@shivambind269-ai add demo |
|
Hi @imDarshanGK, Added demo/testing evidence for the localStorage recovery fix. Test steps:
Attached screenshot demonstrating the behavior. Thank you for the review.
|
imDarshanGK
left a comment
There was a problem hiding this comment.
This PR only adds JSON parse error handling, but the issue is about history not persisting after refresh. Please verify that the actual localStorage persistence and rehydration logic correctly fixes the original problem.
|
Thanks for the review. I re-checked the history persistence flow. The current implementation already saves history to Given the linked issue is specifically about history not persisting after refresh, I agree this PR does not directly address that behavior. I'll investigate whether the refresh issue can still be reproduced on the current codebase and either update the PR with the actual fix or close/retarget it if the issue has already been resolved separately. |
imDarshanGK
left a comment
There was a problem hiding this comment.
This PR does not address the actual issue of Query History not persisting after refresh. It only adds error handling for JSON.parse, but persistence/re-hydration logic should be fixed to ensure history loads correctly from localStorage.
|
Thank you for the feedback. I investigated the current implementation and reproduced the query history flow locally. I verified that:
|
imDarshanGK
left a comment
There was a problem hiding this comment.
Please ensure this PR fixes the root persistence issue (rehydration after refresh), not only JSON error handling.
|
Thank you for the clarification.
|
|
Thank you for the review. I have updated the branch and resolved the merge conflicts with the latest I re-tested the current implementation and verified that query history is persisted, reloaded after refresh, and restored correctly in my local environment. My current change adds recovery handling for malformed Could you please provide the current reproduction steps or scenario where the persistence/rehydration issue still occurs? I would be happy to investigate further and update the PR accordingly. |
imDarshanGK
left a comment
There was a problem hiding this comment.
@shivambind269-ai
The issue reports that Query History is not persisting after browser refresh. However, this PR only adds error handling when reading data from localStorage.
Please explain how this change fixes the reported bug and provide a demo showing:
- Add an analysis entry.
- Refresh the page.
- Verify the history is still present.
- Reopen the browser and verify the history remains available.
Also indicate whether any changes were made to the history save logic.
|
Thank you for the review. After re-checking the implementation and my changes, I confirm that this PR does not modify the history save logic. The existing save logic remains unchanged: localStorage.setItem('qyx_history', JSON.stringify(history)); The change in this PR is limited to handling cases where
|

Summary
This PR improves the reliability of Query History persistence by adding safe recovery logic when loading history from localStorage.
Changes Made
JSON.parse()when readingqyx_history.Why This Change?
Although Query History is already stored in localStorage, corrupted or invalid JSON data can cause parsing failures during initialization. This change makes the history loading process more robust and improves user experience.
Testing
qyx_history.Fixes #718