Event Subscription Issue with Draft Submissions

The behavior on edit draft submission:

1) Edit a draft submission.
2) Have fields that are in error on the form submit
3) Click on save

This causes the code I wrote to pass the guard condition on eventService.js on line 20.

 

Solutions?
1) Not sure if adding an and condition for !data.draft would solve it as it probably is always true when editing a draft. - Tested this and it always comes in as draft = true on submit of draft

2) Failing a submission should set the data.data.submit flag back to false?

The following seems to prevent the behavior from occuring as a temporary solution until Jason rewrites event subscription:

 

var isValid = form.checkValidity(form.submission.data);

if (isValid) {
data.submit = true;
let that = this;
that.parent.root = form;
form.emit('submitButton', { state: 'submitted', component: that, instance: that, data:form.submission.data }); } else {

form.submit(); data.submit = false;

}

image-20240621-180736.png



nfeli - Discusses the issue in discord on chefs-tldr

 

image-20240621-170959.png