Skip to content

Commit

Permalink
reduce props.value reading by using variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Havunen committed Oct 30, 2023
1 parent b8396c6 commit c6ea9c5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/inferno/src/DOM/wrappers/SelectWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ function updateChildOptions(vNode: VNode, value): void {

function updateChildOption(vNode: VNode, value: unknown): void {
const props: any = vNode.props ?? EMPTY_OBJ;
const propsValue = props.value;
const dom = vNode.dom as any;

// we do this as multiple prop may have changed
dom.value = props.value;
dom.value = propsValue;

if (
props.value === value ||
(isArray(value) && value.includes(props.value))
) {
if (propsValue === value || (isArray(value) && value.includes(propsValue))) {
dom.selected = true;
} else if (!isNullOrUndef(value) || !isNullOrUndef(props.selected)) {
dom.selected = Boolean(props.selected);
Expand Down

0 comments on commit c6ea9c5

Please sign in to comment.