-
Notifications
You must be signed in to change notification settings - Fork 47
feat: FORMS-2670 Client-side auto-save with localStorage for form data protection #1754
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
feat: FORMS-2670 Client-side auto-save with localStorage for form data protection #1754
Conversation
|
@revanth-banala When user goes offline in between filling the form, it shows outage screen first, then I had to refresh the page. Seems like after that all the data lost. Can you check that? |
|
jasonchung1871
left a comment
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.
Is the lack of telemetry/logging for auto-save and recovery intentional? If the feature misbehaves, we won't have much diagnostic data to work with. Users might report issues we can't trace.
We might want to add a warning or restrict auto-save for forms marked as sensitive. localStorage is global to the browser context, any script running on the page (including form.io components) could potentially access saved data. It's not a huge issue, but it does mean that someone could create a malicious form to grab form data from auto-save.
|
@revanth-banala One of the cypress test failed on this PR. When a submitter recall a submission, it still saving the old value in the input field, not the updated one. Could you please check? |
This comment has been minimized.
This comment has been minimized.
jasonchung1871
left a comment
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.
I think my only concern left with this is for older computers that may be trying to autosave on a larger form. They could be saving still while autosave attempts to save again. This would need to increase the debounce delay.
usingtechnology
left a comment
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.
Great feature, looking forward to seeing it in action.
Minor tweaks (may affect your unit tests). 👍
app/frontend/src/components/designer/LocalAutosaveRecoveryDialog.vue
Outdated
Show resolved
Hide resolved
|
@revanth-banala Please deploy again if recalling submission issue fixed. |
|
usingtechnology
left a comment
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.
Nice work. Let's see how it works in the wild!





Description
Phase 1 of offline form capabilities by implementing browser-based autosave that protects users from losing form progress
This PR introduces a browser-based autosave feature that protects users from losing form progress due to accidental browser closures, refreshes, or crashes. The feature stores form data locally in the browser's localStorage and provides a recovery dialog when users return to continue their work.
New Feature - Form progress protection via local autosave
Database Migration - Adds enableAutoSave column to form table
UI Enhancement - Recovery dialog and settings toggle
Changes Made
Core Features:
Local Autosave System (useLocalAutosave.js)
Debounced saving (3-second delay) to localStorage
Silent failure mode to prevent blocking form operations
Storage key based on formId, userId, versionId, submissionId
Automatic cleanup on successful submission
Recovery Dialog (LocalAutosaveRecoveryDialog.vue)
Prompts users to restore or discard locally saved progress
Only shows when local data is newer than server data
FormViewer Integration
Autosave triggers on form changes (excluding initial load)
Smart beforeunload warnings (suppressed when autosave is active)
Recovery check on component mount
Form Settings
New toggle: "Enable Form Progress Protection"
Database field: enableAutoSave (default: false)
Available in form functionality settings
Technical Implementation:
Storage format: chefs_autosave_[formId]:[userId]:[versionId]:[submissionId]
Data structure: { timestamp: ISO_STRING, data: formData }
Graceful handling of localStorage unavailability (private browsing, quota exceeded)
Low Risk (Safe Changes)
Feature is opt-in (disabled by default)
Silent failure mode prevents breaking existing functionality
Composable pattern for clean separation of concerns
Recovery dialog is non-blocking
Backward compatible database migration
Type of Change
feat (a new feature)
Checklist
Further comments