Skip to content

Commit

Permalink
fix(gv-policy-studio): mark flow as dirty only if has changed
Browse files Browse the repository at this point in the history
fix #376
  • Loading branch information
gcusnieux committed Jun 14, 2021
1 parent 305180d commit 9a851cb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/policy-studio/gv-policy-studio.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,12 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {

_onSubmitFlow({ detail: { values } }) {
const selectedFlow = this.getSelectedFlow();
Object.assign(selectedFlow, values, { _dirty: true });
this.isDirty = true;
this._refresh();
const selectedFlowUpdated = Object.assign({}, selectedFlow, values);
if (!deepEqual(selectedFlow, selectedFlowUpdated)) {
Object.assign(selectedFlow, selectedFlowUpdated, { _dirty: true });
this.isDirty = true;
this._refresh();
}
}

_onCancelFlowMode() {
Expand Down Expand Up @@ -1335,7 +1338,9 @@ export class GvPolicyStudio extends KeyboardElement(LitElement) {
.filter((form) => {
const isValid = form.isValid();
if (isValid) {
form.submit();
if (form.dirty) {
form.submit();
}
}
return !isValid;
})
Expand Down

0 comments on commit 9a851cb

Please sign in to comment.