Compare commits

...

3 Commits

4 changed files with 7 additions and 31 deletions

View File

@@ -352,10 +352,10 @@ pub fn handle_server_fns_with_context(
owner
.with(|| {
ScopedFuture::new(async move {
additional_context();
provide_context(Request::new(&req));
let res_options = ResponseOptions::default();
provide_context(res_options.clone());
additional_context();
// store Accepts and Referer in case we need them for redirect (below)
let accepts_html = req

View File

@@ -381,10 +381,10 @@ async fn handle_server_fns_inner(
owner
.with(|| {
ScopedFuture::new(async move {
additional_context();
provide_context(parts);
let res_options = ResponseOptions::default();
provide_context(res_options.clone());
additional_context();
// store Accepts and Referer in case we need them for redirect (below)
let accepts_html = req
@@ -2053,8 +2053,8 @@ where
} else {
let mut res = handle_response_inner(
move || {
additional_context();
provide_context(state.clone());
additional_context();
},
move || shell(options),
req,

View File

@@ -361,7 +361,7 @@ fn normalized_call_site(site: proc_macro::Span) -> Option<String> {
cfg_if::cfg_if! {
if #[cfg(all(debug_assertions, feature = "nightly", rustc_nightly))] {
Some(leptos_hot_reload::span_to_stable_id(
site.source_file().path(),
site.file(),
site.start().line()
))
} else {

View File

@@ -4,7 +4,7 @@ use reactive_graph::{
traits::DefinedAt,
};
use server_fn::{
error::{FromServerFnError, ServerFnErrorErr, ServerFnErrorWrapper},
error::{FromServerFnError, ServerFnUrlError},
ServerFn,
};
use std::{ops::Deref, panic::Location, sync::Arc};
@@ -62,19 +62,7 @@ where
pub fn new() -> Self {
let err = use_context::<ServerActionError>().and_then(|error| {
(error.path() == S::PATH)
.then(|| {
error
.err()
.parse::<ServerFnErrorWrapper<S::Error>>()
.map(|e| e.0)
.unwrap_or_else(|e| {
S::Error::from_server_fn_error(
ServerFnErrorErr::Deserialization(
e.to_string(),
),
)
})
})
.then(|| ServerFnUrlError::<S::Error>::decode_err(error.err()))
.map(Err)
});
Self {
@@ -162,19 +150,7 @@ where
pub fn new() -> Self {
let err = use_context::<ServerActionError>().and_then(|error| {
(error.path() == S::PATH)
.then(|| {
error
.err()
.parse::<ServerFnErrorWrapper<S::Error>>()
.map(|e| e.0)
.unwrap_or_else(|e| {
S::Error::from_server_fn_error(
ServerFnErrorErr::Deserialization(
e.to_string(),
),
)
})
})
.then(|| ServerFnUrlError::<S::Error>::decode_err(error.err()))
.map(Err)
});
Self {