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

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

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

@ -509,7 +509,7 @@ export function build_component(node, component_name, context) {
'$.async',
anchor,
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;
}
async_ids() {
return this.async.map((memo) => memo.id);
}
async_values() {
if (this.async.length === 0) return;
return b.array(this.async.map((memo) => b.thunk(memo.expression, true)));

Loading…
Cancel
Save