Replies: 4 comments
-
Your callback will run in the browser (not use cached data) by passing const post = useDeno(async () => {
return await (await fetch(`https://.../post/${params.id}`)).json();
}, true); Why would you want to make a round trip to the server to get data, instead of making a localized async call to an API? What's the advantage or use case? |
Beta Was this translation helpful? Give feedback.
-
@rliang I think @ije added ISR (incremental static regeneration) which may be what you are looking for. |
Beta Was this translation helpful? Give feedback.
-
in 0.3 branch, the second argument is |
Beta Was this translation helpful? Give feedback.
-
Ah yes, I didn't realize that the second argument changed. Wouldn't setting revalidate to 0 make it work like |
Beta Was this translation helpful? Give feedback.
-
In Next.js,
getServerSideProps
is called server-side on each refresh, and it is able to access Node.js APIs. In Aleph,useDeno(..., true)
is called on each refresh, but not server-side. I suppose I could get around that by adding an API route and haveuseDeno
fetch it.However, I think it would be a big productivity bonus if the hook could always access the backend. Perhaps by having Aleph auto-generate an API route, even.
If possible, would you be willing to consider adding this functionality?
Beta Was this translation helpful? Give feedback.
All reactions