elliott/add-variadic-snippets
S. Elliott Johnson 6 months ago
parent e8153dcbbc
commit 9b0199946b

@ -592,10 +592,8 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
const child_scope = state.scope.child();
scopes.set(node, child_scope);
if (node.context) {
for (const id of extract_identifiers(node.context)) {
child_scope.declare(id, 'each', 'let');
}
for (const id of extract_identifiers(node.context)) {
child_scope.declare(id, 'each', 'let');
}
context.next({ scope: child_scope });

@ -2843,16 +2843,16 @@ export function sanitize_slots(props) {
/**
* @param {() => Function} get_snippet
* @param {Node} node
* @param {() => any} args
* @param {(() => any)[]} args
* @returns {void}
*/
export function snippet_effect(get_snippet, node, args) {
export function snippet_effect(get_snippet, node, ...args) {
const block = create_snippet_block();
render_effect(() => {
// Only rerender when the snippet function itself changes,
// not when an eagerly-read prop inside the snippet function changes
const snippet = get_snippet();
untrack(() => snippet(node, args));
untrack(() => snippet(node, ...args));
return () => {
if (block.d !== null) {
remove(block.d);

Loading…
Cancel
Save