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 (#3326)
* 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:
parent
be3c1811fc
commit
2aa9827a1f
1 changed files with 14 additions and 0 deletions
|
@ -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())?;
|
||||
|
|
Loading…
Reference in a new issue