@@ -650,19 +650,16 @@ function build_element_attribute_update(element, node_id, name, value, attribute
650650 * @param {ComponentContext } context
651651 */
652652function 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