Skip to content
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

Merged
merged 13 commits into from
Aug 16, 2024
Merged

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Aug 7, 2024

Not much of a writer so let me know if there are any opinions on topics, direction, etc.!

content/en/blog/prerendering-preset-vite.md Outdated Show resolved Hide resolved
content/en/blog/prerendering-preset-vite.md Outdated Show resolved Hide resolved
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
@rschristian rschristian marked this pull request as ready for review August 8, 2024 22:51
}
```

### Using `globalThis` to pass data around
Copy link
Member

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.

Copy link
Member Author

@rschristian rschristian Aug 15, 2024

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

Copy link
Member

@marvinhagemeister marvinhagemeister left a 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>
@rschristian rschristian merged commit 13b3385 into master Aug 16, 2024
5 checks passed
@rschristian rschristian deleted the blog/prerendering branch August 16, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants