#How to pass a context that needs async?

1 messages · Page 1 of 1 (latest)

upbeat sluice
#

@modern harbor id love some input here!

modern harbor
#

unfortunately that is the easiest approach today

#

The async runtime on the server and client is different so you can't annotate main with #[tokio::main]

#

and you do need to block on the future before rendering anything

upbeat sluice
#

but couldnt a with_context_future take in a future, and then that future is blocked on/awaited by the internal axum launch sequence, which would then add to the context?

modern harbor
#

I would lean towards adding a #[dioxus::main] macro that chooses an async runtime based on the platform instead

#

Yes, we could allow that, but the behavior is less immediately clear (does it block or add the context after it resolves?)

upbeat sluice
#

true

modern harbor
#

And what if my context returns an error or the context?