Skip to content

Commit 8c11e70

Browse files
committed
remove spread_attributes_effect
1 parent 630e571 commit 8c11e70

File tree

2 files changed

+4
-37
lines changed

2 files changed

+4
-37
lines changed

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,7 @@ function serialize_element_spread_attributes(
282282
element.metadata.svg || is_custom_element_node(element) ? b.false : b.true;
283283
const id = context.state.scope.generate('spread_attributes');
284284

285-
const standalone = b.stmt(
286-
b.call(
287-
'$.spread_attributes_effect',
288-
element_id,
289-
b.thunk(b.array(values)),
290-
lowercase_attributes,
291-
b.literal(context.state.analysis.css.hash)
292-
)
293-
);
294-
const inside_effect = b.stmt(
285+
const update = b.stmt(
295286
b.assignment(
296287
'=',
297288
b.id(id),
@@ -306,21 +297,13 @@ function serialize_element_spread_attributes(
306297
)
307298
);
308299

309-
if (!needs_isolation || needs_select_handling) {
310-
context.state.init.push(b.let(id));
311-
}
300+
context.state.init.push(b.let(id));
312301

313302
// objects could contain reactive getters -> play it safe and always assume spread attributes are reactive
314303
if (needs_isolation) {
315-
if (needs_select_handling) {
316-
context.state.init.push(
317-
b.stmt(b.call('$.render_effect', b.arrow([], b.block([inside_effect]))))
318-
);
319-
} else {
320-
context.state.init.push(standalone);
321-
}
304+
context.state.init.push(serialize_update(update));
322305
} else {
323-
context.state.update.push(inside_effect);
306+
context.state.update.push(update);
324307
}
325308

326309
if (needs_select_handling) {

packages/svelte/src/internal/client/dom/elements/attributes.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,6 @@ export function set_custom_element_data(node, prop, value) {
108108
}
109109
}
110110

111-
/**
112-
* Like `spread_attributes` but self-contained
113-
* @param {Element & ElementCSSInlineStyle} dom
114-
* @param {() => Record<string, unknown>[]} attrs
115-
* @param {boolean} lowercase_attributes
116-
* @param {string} css_hash
117-
*/
118-
export function spread_attributes_effect(dom, attrs, lowercase_attributes, css_hash) {
119-
/** @type {Record<string, any> | undefined} */
120-
var current;
121-
122-
render_effect(() => {
123-
current = spread_attributes(dom, current, attrs(), lowercase_attributes, css_hash);
124-
});
125-
}
126-
127111
/**
128112
* Spreads attributes onto a DOM element, taking into account the currently set attributes
129113
* @param {Element & ElementCSSInlineStyle} element

0 commit comments

Comments
 (0)