use default fullstackcontext instead

This commit is contained in:
Jonathan Kelley committed 2025-11-05 14:53:51 -03:00
1 parent af215e4e80
commit 71e01d5be6
2 files changed
+14 -16

No files matched your search

+1 -14
View File
@@ -432,15 +432,6 @@ fn route_impl_with_route(
let extracted_as_server_headers = route.extracted_as_server_headers(query_tokens.clone());
// Generate extraction code based on whether there are server extractors
let extraction_code = if route.server_args.is_empty() {
quote! { Default::default() }
} else {
quote! {
dioxus_fullstack::FullstackContext::extract::<(#(#server_types,)*), _>().await?
}
};
Ok(quote! {
#(#fn_docs)*
#route_docs
@@ -564,11 +555,7 @@ fn route_impl_with_route(
}
// Extract the server arguments from the context if needed.
// If there are no server extractors, use Default::default() which allows
// the function to be called from backend code without HTTP context.
// If there are server extractors, extraction will fail with a clear error
// when called from backend code without HTTP context.
let (#(#server_names,)*) = #extraction_code;
let (#(#server_names,)*) = dioxus_fullstack::FullstackContext::extract::<(#(#server_types,)*), _>().await?;
// Call the function directly
return #fn_on_server_name #ty_generics(