Skip to content

Commit cc8093f

Browse files
committed
chore: parallelize
1 parent 2e033f6 commit cc8093f

File tree

1 file changed

+2
-6
lines changed
  • packages/svelte/src/internal/server

1 file changed

+2
-6
lines changed

packages/svelte/src/internal/server/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ export async function renderStaticHTML(component, options) {
177177
try {
178178
payload = render_payload(component, options);
179179
if (payload.async) {
180-
for (let async_fn of payload.async) {
181-
await async_fn();
182-
}
180+
await Promise.all(payload.async.map((fn) => fn()));
183181
}
184182

185183
let head = payload.head.out + payload.head.title;
@@ -565,9 +563,7 @@ function await_block($$payload, promise, pending_fn, then_fn, catch_fn) {
565563
}
566564
}
567565
if ($$payload.async && new_payload.async) {
568-
for (let async_replace of new_payload.async) {
569-
await async_replace();
570-
}
566+
await Promise.all(new_payload.async.map((fn) => fn()));
571567
}
572568
$$payload.out = $$payload.out.replace(replace_marker, new_payload.out);
573569
$$payload.head.out = $$payload.head.out.replace(replace_marker, new_payload.head.out);

0 commit comments

Comments
 (0)