Skip to content

Commit 4acc60a

Browse files
author
Revanth Banala
committed
fix: disable autosave for editing existing submissions to prevent data conflicts
1 parent 8aa09e8 commit 4acc60a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/frontend/src/components/designer/FormViewer.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,17 +584,25 @@ function formChange(e) {
584584
jsonManager();
585585
586586
// AUTOSAVE – only when:
587+
// - autosave has been initialized
587588
// - form has enableAutoSave turned on
588589
// - not read-only or preview
589590
// - Form.io has valid _data
590-
// - NOT a fromSubmission event (already checked above)
591+
// - user input (not fromSubmission event)
592+
// - NOT editing an existing submission
591593
if (
594+
autosaveInitialized.value &&
592595
form.value?.enableAutoSave &&
593596
!properties.readOnly &&
594597
!properties.preview &&
595598
e.changed &&
596599
!e.changed.flags?.fromSubmission &&
597-
chefForm.value?.formio?._data
600+
chefForm.value?.formio?._data &&
601+
!(
602+
properties.submissionId &&
603+
properties.submissionId !== 'new' &&
604+
properties.submissionId !== 'undefined'
605+
)
598606
) {
599607
localAutosave.save(chefForm.value.formio._data);
600608
}

0 commit comments

Comments
 (0)