diff --git a/packages/fullstack/src/html_storage/mod.rs b/packages/fullstack/src/html_storage/mod.rs
index dd40ce587..f0fbca127 100644
--- a/packages/fullstack/src/html_storage/mod.rs
+++ b/packages/fullstack/src/html_storage/mod.rs
@@ -1,3 +1,5 @@
+#![allow(unused)]
+
use std::sync::atomic::AtomicUsize;
use serde::{de::DeserializeOwned, Serialize};
@@ -34,11 +36,22 @@ impl HTMLDataCursor {
pub fn take(&self) -> Option {
let current = self.index.load(std::sync::atomic::Ordering::SeqCst);
if current >= self.data.len() {
+ log::error!(
+ "Tried to take more data than was available, len: {}, index: {}",
+ self.data.len(),
+ current
+ );
return None;
}
let mut cursor = &self.data[current];
self.index.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
- Some(postcard::from_bytes(&mut cursor).unwrap())
+ match postcard::from_bytes(&mut cursor) {
+ Ok(x) => Some(x),
+ Err(e) => {
+ log::error!("Error deserializing data: {:?}", e);
+ None
+ }
+ }
}
}
diff --git a/packages/fullstack/src/render.rs b/packages/fullstack/src/render.rs
index 9660617d6..c71d0240c 100644
--- a/packages/fullstack/src/render.rs
+++ b/packages/fullstack/src/render.rs
@@ -154,7 +154,7 @@ impl<'a, P: Clone + Serialize + Send + Sync + 'static> dioxus_ssr::incremental::
crate::html_storage::serialize::encode_props_in_element(&self.cfg.props, to)?;
// serialize the server state
crate::html_storage::serialize::encode_in_element(
- &*self.server_context.html_data().map_err(|err| {
+ &*self.server_context.html_data().map_err(|_| {
dioxus_ssr::incremental::IncrementalRendererError::Other(Box::new({
#[derive(Debug)]
struct HTMLDataReadError;
diff --git a/packages/fullstack/src/server_context.rs b/packages/fullstack/src/server_context.rs
index bf84bd524..9315434b8 100644
--- a/packages/fullstack/src/server_context.rs
+++ b/packages/fullstack/src/server_context.rs
@@ -106,7 +106,7 @@ mod server_fn_impl {
}
/// Insert some data into the html data store
- pub(crate) async fn push_html_data(
+ pub(crate) fn push_html_data(
&self,
value: &T,
) -> Result<(), PoisonError>> {
diff --git a/packages/fullstack/src/use_server/mod.rs b/packages/fullstack/src/use_server/mod.rs
index f0f76d16f..0cf15927d 100644
--- a/packages/fullstack/src/use_server/mod.rs
+++ b/packages/fullstack/src/use_server/mod.rs
@@ -20,15 +20,15 @@ use serde::{de::DeserializeOwned, Serialize};
pub fn from_server(server_fn: impl Fn() -> O) -> O {
#[cfg(feature = "ssr")]
{
- let data =
- crate::html_storage::deserialize::take_server_data().unwrap_or_else(|| server_fn());
+ let data = server_fn();
let sc = crate::prelude::server_context();
- sc.push_html_data(&data);
+ if let Err(err) = sc.push_html_data(&data) {
+ log::error!("Failed to push HTML data: {}", err);
+ }
data
}
#[cfg(not(feature = "ssr"))]
{
- let data = server_fn();
- data
+ crate::html_storage::deserialize::take_server_data().unwrap_or_else(|| server_fn())
}
}