2
0
Fork 0
mirror of https://github.com/leptos-rs/leptos synced 2025-02-02 23:13:25 +00:00

fix: correctly support !Send Actix APIs in server functions ()

* fix: correctly support `!Send` Actix APIs in server functions

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Greg Johnston 2024-12-07 15:41:32 -05:00 committed by GitHub
parent be3c1811fc
commit 2aa9827a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,6 +188,20 @@ pub fn server_macro_impl(
})
.collect::<Result<Vec<_>>>()?;
// we need to apply the same sort of Actix SendWrapper workaround here
// that we do for the body of the function provided in the trait (see below)
if cfg!(feature = "actix") {
let block = body.block.to_token_stream();
body.block = quote! {
{
#server_fn_path::actix::SendWrapper::new(async move {
#block
})
.await
}
};
}
let dummy = body.to_dummy_output();
let dummy_name = body.to_dummy_ident();
let args = syn::parse::<ServerFnArgs>(args.into())?;