Skip to content

Commit

Permalink
fix: replaced empty string with undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthramesh committed May 29, 2021
1 parent daf254b commit 9f4d88e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/medblocks/quantity/quantity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,21 @@ export default class MbQuantity extends QuantityElement {

handleSelect(e: CustomEvent) {
const select = e.target as SlSelect;
this.data = {
...this.data,
unit: select.value as string,
};
if (select.value) {
this.data = {
...this.data,
unit: select.value as string,
};
} else {
if (this.data?.magnitude) {
this.data = {
...this.data,
unit: undefined,
};
} else {
this.data = undefined;
}
}
}
render() {
return html`
Expand Down

0 comments on commit 9f4d88e

Please sign in to comment.