-
Notifications
You must be signed in to change notification settings - Fork 139
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
Parameterized data loaders & pages #245
Comments
This would also apply to data loaders requested from parameterized pages. For example you could have a route The challenge is that we’ll need some way to enumerate all the possible values of the |
I can see how we could generate it from all links found in the static pages (since it would be nice to test links anyway, per #363), but also how it could be in the config (as an array), or in front-matter, like: ---
login:
- one
- two
- three
--- |
I'm highly interested in this. As an example, I have some code that does (somewhat intensive) simulations in Rust. I'd love to be able to parameterize those simulations in the call to the data loader and have the data be cached. Ideally, this means that I can write the data loader file ( Without parameterized data loaders, I can achieve something similar by making many different I can also imagine solving this with a feature such as #145. That might be more flexible, though I haven't thought it through and it'd also be annoying to have to constantly write out the Cargo.toml preamble. |
We could also require that the values be enumerated in the config file (for build, not for preview where it would be uncontrolled—leaving the developer free to explore). |
Sveltekit solves that by crawling + optional configuration when prerendering or a static target is requested : |
What if we supported dynamic routes for data loaders, e.g.
customer/@[login].csv.ts
would matchcustomer/@mbostock.csv
, and would pass--login=mbostock
as a command-line argument (parameter) to the data loader. This way you could use the same data loader to generate multiple files (though all files would need to be statically referenced in order to be built).The text was updated successfully, but these errors were encountered: