static adapter and fetching data #7334
-
|
I moved the static adapter in order to prerender all the pages and it works beautifully. The problem is that the data in external json is fetched at build time and they are not updated unless I rebuild the site. Is there a way to keep all my pages static except specific routes that will be hydrated? I understand that this requires javascript and I am fine with that on those specific pages. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Have you tried fetching the data in an |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, that is actually the solution I just deployed, now I need to test if
it actually works. I'll share the link to the repo if I succeed.
…On Fri, 21 Oct 2022 at 18:05, Tee Ming ***@***.***> wrote:
Have you tried fetching the data in an onMount() function or using an
{#await} block?
(Not sure if this works as I haven't done this before)
—
Reply to this email directly, view it on GitHub
<#7334 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABLZOF2VANVIVWH623PSELWEK5K7ANCNFSM6AAAAAARKR246A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
So yes, it is working, rewriting data object onmount seems to be a good option. I was also considering service workers, but this is simple and working. Example code is in https://github.com/vorcigernix/ethbrno_workshop/tree/swr-markdown/src/routes (+page files). |
Beta Was this translation helpful? Give feedback.
-
|
An alternative to |
Beta Was this translation helpful? Give feedback.
Have you tried fetching the data in an
onMount()function or using an{#await}block?(Not sure if this works as I haven't done this before)