You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a Sycamore app (it's been great so far), and I have a backend server that provides an API, as well as serves the SSR version of the site which is then hydrated in the browser.
Most of the content on each page is fetched at runtime in the client via a spawn_local_scoped call that does a network request to the API (which does a couple async DB queries with sqlx and produces the data). However, this data is nearly all static, so I'd like to render it on the server if possible. This would be entirely doable if there were a way of either
directly running my async get_item_by_id function within the view at SSR time (faster)
doing a network call to the API at SSR time (lets me reuse my existing client API interaction code)
Either of these is easy to do if I have access to the async context that Sycamore seems to run render_to_string in. Without it, a naked spawn_local_scoped crashes without access to a LocalSet, but I can't create a Tokio runtime myself either because we're already within one somehow (and provide_executor_scope is useless without some way to await on the future it returns).
The text was updated successfully, but these errors were encountered:
I'm building a Sycamore app (it's been great so far), and I have a backend server that provides an API, as well as serves the SSR version of the site which is then hydrated in the browser.
Most of the content on each page is fetched at runtime in the client via a
spawn_local_scoped
call that does a network request to the API (which does a couple async DB queries withsqlx
and produces the data). However, this data is nearly all static, so I'd like to render it on the server if possible. This would be entirely doable if there were a way of eitherget_item_by_id
function within the view at SSR time (faster)Either of these is easy to do if I have access to the async context that Sycamore seems to run
render_to_string
in. Without it, a nakedspawn_local_scoped
crashes without access to aLocalSet
, but I can't create a Tokio runtime myself either because we're already within one somehow (andprovide_executor_scope
is useless without some way to await on the future it returns).The text was updated successfully, but these errors were encountered: