Skip to content

Commit b079256

Browse files
committed
more
1 parent 2cc4c1a commit b079256

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -650,19 +650,16 @@ function build_element_attribute_update(element, node_id, name, value, attribute
650650
* @param {ComponentContext} context
651651
*/
652652
function build_custom_element_attribute_update_assignment(node_id, attribute, context) {
653-
const state = context.state;
654-
const name = attribute.name; // don't lowercase, as we set the element's property, which might be case sensitive
655-
let { value, has_state } = build_attribute_value(attribute.value, context);
653+
const { value, has_state } = build_attribute_value(attribute.value, context);
656654

657-
const call = b.call('$.set_custom_element_data', node_id, b.literal(name), value);
655+
// don't lowercase name, as we set the element's property, which might be case sensitive
656+
const call = b.call('$.set_custom_element_data', node_id, b.literal(attribute.name), value);
658657

659-
if (has_state) {
660-
// this is different from other updates — it doesn't get grouped,
661-
// because set_custom_element_data may not be idempotent
662-
state.init.push(b.stmt(b.call('$.template_effect', b.thunk(call))));
663-
} else {
664-
state.init.push(b.stmt(call));
665-
}
658+
// this is different from other updates — it doesn't get grouped,
659+
// because set_custom_element_data may not be idempotent
660+
const update = has_state ? b.call('$.template_effect', b.thunk(call)) : call;
661+
662+
context.state.init.push(b.stmt(update));
666663
}
667664

668665
/**

0 commit comments

Comments
 (0)