-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
bugSomething isn't workingSomething isn't workingfullstackrelated to the fullstack craterelated to the fullstack crate
Description
Problem
Effects aren't run on the client if the server throws an error through a suspense boundary
Steps To Reproduce
Steps to reproduce the behavior:
Run this reproduction from this thread in discord:
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
#[server]
pub async fn delayed_error() -> Result<(), ServerFnError> {
// It works without this delay, but breaks with the delay
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
Err(ServerFnError::new("dot dot dot"))
}
#[component]
fn SimpleEffect() -> Element {
use_effect(move || panic!("boo"));
rsx! {
{"Simple effect rsx"}
}
}
#[component]
fn app() -> Element {
rsx! {
ErrorComp {
SuspenseBoundary {
fallback: |_context: SuspenseContext| rsx! {
div { "Loading..." }
},
ErrorPage {}
}
}
}
}
#[component]
fn ErrorPage() -> Element {
use_server_future(|| async move { delayed_error().await })?
.read()
.as_ref()
.cloned()
.unwrap()?;
rsx! {}
}
#[component]
fn ErrorComp(children: Element) -> Element {
rsx! {
ErrorBoundary {
handle_error: |_| {
rsx! {
{"Hello from error comp"}
SimpleEffect {}
}
},
{children}
}
}
}
Expected behavior
The effect should run
Environment:
- Dioxus version: main
- Rust version: nightly
- OS info: macOS
- App platform: web
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfullstackrelated to the fullstack craterelated to the fullstack crate