server only functions #1627
amitu
started this conversation in
Ideas & RFCs
Replies: 1 comment
-
Server Functions During SSR and HydrationIt would be not smart to call server function both during page generation on server side during initial page load and again in client side during hydration. So we should call all server functions on server during SSR, and store the result of each such function, and include in the page itself, so when the function is called during hydration we do not have to make Ajax call. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A function in fastn can be written with
$server$: true
to declare itself to be a server function:When
foo
is called from server, the body will be executed in line during page generation, but if it is called from client it will become an AJAX call, and will be executed on server and response would be sent.A bit like this:
Beta Was this translation helpful? Give feedback.
All reactions