-
Notifications
You must be signed in to change notification settings - Fork 170
add vanilla.js #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ryoppippi
commented
Apr 11, 2024
|
I think the purpose of this benchmark is to compare SSR implementations with Suspense. I know this can be a good baseline but somehow a async/suspense logic should be added before this can be actually compared to others... |
| export async function buildHandler(){ | ||
| return async function handler(_: IncomingMessage, res: ServerResponse) { | ||
| const { html } = await renderHtml() | ||
| res.setHeader("Content-Type", "text/html") | ||
| res.end(html) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is something like async/suspense logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a sync render. "Suspense logic" first renders a fallback html then hydrates it with the resolved content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could hydrate a shadowroot. It allows for fallbacks content while waiting for the next chunk of the response to stream in:
<body>
<div>
<template shadowrootmode=open>
<slot>Loading...</slot>
</template>
<!-- here some async work can happen -->
${renderTable()}
</div>
</body>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who's ready for yet another new framework?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get it. I think it's enough. Did you see the bundled result from Marko? It's nearly the same as mine.
|
This should be added as a baseline. Frameworks adding overhead is not vanilla js's fault. |
|
Thank you @b3nten !! |
