-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
blog: Prerendering with @preact/preset-vite
#1174
Conversation
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
} | ||
``` | ||
|
||
### Using `globalThis` to pass data around |
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 like the later example of having a global cache to write to, but I'm a bit unsure about passing other data. I'm worried that this could lead to race conditions given that we also support async rendering in RTS now.
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.
In the first example? I don't see how there could be any race conditions, short of someone forgetting to await
the async RTS.
And, fundamentally, passing data out of the render tree (like with the document.title
example) is quite difficult without globalThis
-- you'd be left with trying to parse it out of the resulting HTML in all likelihood.
Edit: Misread slightly
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 really like this blog posts. It's very well written. Left two minor comments
Co-authored-by: Ryan Christian <33403762+rschristian@users.noreply.github.com>
Not much of a writer so let me know if there are any opinions on topics, direction, etc.!