-
Notifications
You must be signed in to change notification settings - Fork 0
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
Direct Routing Support #76
Comments
One other slightly crazy idea I had was whether or not route rendering could be parallelized and cached at the Bazel layer. It's relatively easy to parallelize async render calls of routes. I say "relatively", it's actually a more complicated than you might think with generators. But ultimately if you have one Instead, I was imagining "sharding" the prerender_pages(
name = "site",
# ...
route_shards = [
[ "/blog/**" ], # Shard 1 renders only the blog posts.
[ "/help/**" ], # Shard 2 renders only the help pages.
[ "/**" ], # Shard 3 renders everything else.
],
) This would probably need to be in a new router-aware rule like If we instead define the API as: prerender_routes(
name = "site",
# ...
routes = [
"//path/to/site/www:home",
"//path/to/site/www:about",
"//path/to/site/www/blog",
"//path/to/site/www/help",
],
) Then if each export default {
label: 'Home',
render: () => { /* ... */ },
}; Then we could actually make each sharded action only depend on the files needed to render! The shard which renders the home page doesn't need to have a dependency on the One challenge with this is the requirement:
This does mean that the home page still needs to know that about exists, even if it isn't rendered. Either we need to design the
I think it's a cool idea at least and one worth exploring after initial routing support. |
So I was originally expecting that
@rules_prerender
wouldn't really need a routing solution because it would be generic enough to support any kind of site routing. Theexport default
entry broad is powerful enough to mostly do whatever users could want to do. However, while working on the docs site, I've changed my mind for a couple reasons.I'm working on a proof-of-concept directly in the docs site, but I think upstreaming a more comprehensive implementation would be very useful. Currently this looks something like:
The exact shape of this is TBD, but some requirements to consider based on this use case:
/products/:id
.The text was updated successfully, but these errors were encountered: