Skip to content
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

Save survey progress locally to prevent losing it #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zaynOm
Copy link

@zaynOm zaynOm commented Dec 30, 2024

This pull request introduces functionality to save and load survey progress, ensuring users can resume where they left off.

It will Close #130

Changes Include:

  1. Save Progress:
  • Form data, sectionId, and questionId are saved to local storage after each step.
  • Utilized helper functions to handle JSON serialization and deserialization for consistency.
  1. Load Progress:
  • Default form values are pre-filled using data retrieved from local storage.
  • Handled cases where no saved data exists (fallback to default state).

Why This is Needed:

  • Improves user experience by allowing users to resume incomplete surveys.
  • Prevents data loss when users accidentally close the browser or navigate away.

- Save user progress (form data, section index, question index) to local
storage.
- Load saved progress as default values when the survey is reopened.
- Update the progress bar value to match the locally saved data
@yjose
Copy link
Member

yjose commented Dec 31, 2024

Thank you @zaynOm for woking on this. i still didnt have the chance to review it but here is few remarks so far:

  • Today is the last day of the survey, so it will probably be ready for next year's edition.
  • As the form survey form is very critical, I recommend writing tests for the new functionality. , check here

@zaynOm
Copy link
Author

zaynOm commented Dec 31, 2024

Sure making changes while the survey's on isn't a good idea. I'll work on refactoring the code and writing some tests to make sure it doesn't break anything

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.

No saved progress after page refresh
2 participants