Maybe separate load function into separate static and server functions? #3915
Replies: 2 comments 5 replies
-
If you want to only prerender some pages, you need to use a different adapter than adapter-static. You will need to choose what host will be rendering the non-prerendered pages. You can can then prerender a single page with |
Beta Was this translation helpful? Give feedback.
-
I wanted to create separate topic, but probaby this is what I am also looking for: My project has a page: /product/[slug] Information about product (name, description, graphic url) are stored in database (Supabase) Moving all data code into +page.svelte script tag makes it MUCH faster. Document load takes only ~50 ms ! It is great! However this way prefetch does not work, so when user hovers over my product it does not gather data from Supabase to display next page much faster The question is how to make prefetch work, when I retrieve data in +page.svelte script tag ? Tried using prerender. However build for 2000 urls' took 50 minutes, so it's not an option. Kind regards, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We have a load function which runs live, in a server, or at build time.
But what if I need to run a function only at build time?
The solution is to use adapter static...
But apparently this will make the whole site static.
But what if I need some pages to be prerendered and some to be run on each request by the server?
Maybe there is already a solution for this, but I am not aware of it.
Another way which is more reasonable is to provide static, and server as separate functions (like
getStaticProps()
andgetServerSideProps()
in nextjs) instead of a singleload
function.I initially thought to open an issue but considering this problem might already have a solution, I am starting a discussion.
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions