feat: add support for <Head> component (#67)

This component only works during SSR, during the inital render. It does
not work on renders inside a suspense boundary, or client renders.
This commit is contained in:
Luca Casonato
2021-10-04 11:35:01 +02:00
committed by GitHub
parent 4a6b57de89
commit f343e8bac7
5 changed files with 50 additions and 9 deletions
+9 -2
View File
@@ -159,8 +159,15 @@ export class ServerContext {
});
const bodyStream = new ReadableStream<Uint8Array>({
async start(controller) {
for await (const chunk of body) {
controller.enqueue(new TextEncoder().encode(chunk));
try {
for await (const chunk of body) {
controller.enqueue(new TextEncoder().encode(chunk));
}
} catch (err) {
console.log("Rendering failed:\n", err);
controller.enqueue(
new TextEncoder().encode("500 Internal Server Error"),
);
}
controller.close();
},