Skip to content

Commit

Permalink
append newline to trigger script evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Feb 20, 2023
1 parent f8b3d50 commit 6ac935e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-fishes-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: append newline to trigger script evaluation
4 changes: 2 additions & 2 deletions packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export async function render_response({
: new Response(
new ReadableStream({
async start(controller) {
controller.enqueue(encoder.encode(transformed));
controller.enqueue(encoder.encode(transformed + '\n'));
for await (const chunk of chunks) {
controller.enqueue(encoder.encode(chunk));
}
Expand Down Expand Up @@ -525,7 +525,7 @@ function get_data(event, options, nodes, global) {
str = devalue.uneval({ id, data, error }, replacer);
}

push(`\n<script>${global}.resolve(${str})</script>`);
push(`<script>${global}.resolve(${str})</script>\n`);
if (count === 0) done();
}
);
Expand Down

0 comments on commit 6ac935e

Please sign in to comment.