pull/15844/head
Rich Harris 3 months ago
parent 7d6b60391e
commit 7bbb64060a

@ -76,10 +76,7 @@ export function RenderTag(node, context) {
'$.async', '$.async',
context.state.node, context.state.node,
memoizer.async_values(), memoizer.async_values(),
b.arrow( b.arrow([context.state.node, ...memoizer.async_ids()], b.block(statements))
[context.state.node, ...memoizer.async.map((memo) => memo.id)],
b.block(statements)
)
) )
) )
); );

@ -85,10 +85,7 @@ export function SlotElement(node, context) {
'$.async', '$.async',
context.state.node, context.state.node,
async_values, async_values,
b.arrow( b.arrow([context.state.node, ...memoizer.async_ids()], b.block(statements))
[context.state.node, ...memoizer.async.map((memo) => memo.id)],
b.block(statements)
)
) )
) )
); );

@ -509,7 +509,7 @@ export function build_component(node, component_name, context) {
'$.async', '$.async',
anchor, anchor,
async_values, async_values,
b.arrow([b.id('$$anchor'), ...memoizer.async.map(({ id }) => id)], b.block(statements)) b.arrow([b.id('$$anchor'), ...memoizer.async_ids()], b.block(statements))
) )
); );
} }

@ -39,6 +39,10 @@ export class Memoizer {
return all; return all;
} }
async_ids() {
return this.async.map((memo) => memo.id);
}
async_values() { async_values() {
if (this.async.length === 0) return; if (this.async.length === 0) return;
return b.array(this.async.map((memo) => b.thunk(memo.expression, true))); return b.array(this.async.map((memo) => b.thunk(memo.expression, true)));

Loading…
Cancel
Save