Skip to content

Commit 160bce5

Browse files
committed
chore: add comments
1 parent e26d8ff commit 160bce5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,9 @@ function build_element_attribute_update_assignment(
537537

538538
let { value, has_state } = build_attribute_value(attribute.value, context, (value, metadata) =>
539539
metadata.has_call
540-
? is_autofocus
540+
? // if it's autofocus we will not add this to a template effect so we don't want to get the expression id
541+
// but separately memoize the expression
542+
is_autofocus
541543
? memoize_expression(state, value)
542544
: get_expression_id(state, value)
543545
: value
@@ -678,7 +680,8 @@ function build_element_special_value_attribute(element, node_id, attribute, cont
678680

679681
const { value, has_state } = build_attribute_value(attribute.value, context, (value, metadata) =>
680682
metadata.has_call
681-
? is_select_with_value
683+
? // if is a select with value we will also invoke `init_select` which need a reference before the template effect so we memoize separately
684+
is_select_with_value
682685
? memoize_expression(context.state, value)
683686
: get_expression_id(state, value)
684687
: value

0 commit comments

Comments
 (0)