Skip to content

Commit

Permalink
perf(form): remove extra bool check on events
Browse files Browse the repository at this point in the history
  • Loading branch information
DukeFerdinand committed Feb 11, 2025
1 parent b215d31 commit d01e0f3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions components/form/src/auro-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,25 +422,19 @@ export class AuroForm extends LitElement {
this._addElementToState(event.target);
}

let needsUpdate = false;
// Check special input types and handle their edge cases
if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
this.formState[targetName].value = event.target.values;

needsUpdate = true;
} else {
this.formState[targetName].value = event.target.value;
needsUpdate = true;
}

if (needsUpdate) {
this.requestUpdate('formState');
this.dispatchEvent(new CustomEvent('change', {
bubbles: true,
composed: true,
cancelable: true
}));
}
this.requestUpdate('formState');
this.dispatchEvent(new CustomEvent('change', {
bubbles: true,
composed: true,
cancelable: true
}));
}

/**
Expand Down

0 comments on commit d01e0f3

Please sign in to comment.