From c6ea9c542f4ba4b12082c2bd7fb016919a2b28db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sampo=20Kivist=C3=B6?= Date: Mon, 30 Oct 2023 21:01:01 +0200 Subject: [PATCH] reduce props.value reading by using variable --- packages/inferno/src/DOM/wrappers/SelectWrapper.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/inferno/src/DOM/wrappers/SelectWrapper.ts b/packages/inferno/src/DOM/wrappers/SelectWrapper.ts index 7b413b719..112b1ab26 100644 --- a/packages/inferno/src/DOM/wrappers/SelectWrapper.ts +++ b/packages/inferno/src/DOM/wrappers/SelectWrapper.ts @@ -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);