@@ -196,25 +196,21 @@ function build_dynamic_element_attributes(element, attributes, context, element_
196
196
attribute . type === 'SpreadAttribute' && attribute . metadata . expression . has_call ;
197
197
}
198
198
199
+ const call = b . call (
200
+ '$.set_attributes' ,
201
+ element_id ,
202
+ is_reactive ? attributes_id : b . literal ( null ) ,
203
+ b . object ( values ) ,
204
+ context . state . analysis . css . hash !== '' && b . literal ( context . state . analysis . css . hash ) ,
205
+ b . binary ( '!==' , b . member ( element_id , 'namespaceURI' ) , b . id ( '$.NAMESPACE_SVG' ) ) ,
206
+ is_ignored ( element , 'hydration_attribute_changed' ) && b . true ,
207
+ b . call ( b . member ( b . member ( element_id , 'nodeName' ) , 'includes' ) , b . literal ( '-' ) )
208
+ ) ;
209
+
199
210
if ( is_reactive ) {
200
211
context . state . init . push ( b . let ( attributes_id ) ) ;
201
212
202
- const update = b . stmt (
203
- b . assignment (
204
- '=' ,
205
- attributes_id ,
206
- b . call (
207
- '$.set_attributes' ,
208
- element_id ,
209
- attributes_id ,
210
- b . object ( values ) ,
211
- context . state . analysis . css . hash !== '' && b . literal ( context . state . analysis . css . hash ) ,
212
- b . binary ( '!==' , b . member ( element_id , 'namespaceURI' ) , b . id ( '$.NAMESPACE_SVG' ) ) ,
213
- is_ignored ( element , 'hydration_attribute_changed' ) && b . true ,
214
- b . call ( b . member ( b . member ( element_id , 'nodeName' ) , 'includes' ) , b . literal ( '-' ) )
215
- )
216
- )
217
- ) ;
213
+ const update = b . stmt ( b . assignment ( '=' , attributes_id , call ) ) ;
218
214
219
215
if ( needs_isolation ) {
220
216
context . state . init . push ( build_update ( update ) ) ;
@@ -225,19 +221,6 @@ function build_dynamic_element_attributes(element, attributes, context, element_
225
221
return true ;
226
222
}
227
223
228
- context . state . init . push (
229
- b . stmt (
230
- b . call (
231
- '$.set_attributes' ,
232
- element_id ,
233
- b . literal ( null ) ,
234
- b . object ( values ) ,
235
- context . state . analysis . css . hash !== '' && b . literal ( context . state . analysis . css . hash ) ,
236
- b . binary ( '!==' , b . member ( element_id , 'namespaceURI' ) , b . id ( '$.NAMESPACE_SVG' ) ) ,
237
- is_ignored ( element , 'hydration_attribute_changed' ) && b . true ,
238
- b . call ( b . member ( b . member ( element_id , 'nodeName' ) , 'includes' ) , b . literal ( '-' ) )
239
- )
240
- )
241
- ) ;
224
+ context . state . init . push ( b . stmt ( call ) ) ;
242
225
return false ;
243
226
}
0 commit comments