diff --git a/packages/core/src/virtual_dom.rs b/packages/core/src/virtual_dom.rs index 68a4e5a1b..dce5415f6 100644 --- a/packages/core/src/virtual_dom.rs +++ b/packages/core/src/virtual_dom.rs @@ -542,7 +542,12 @@ impl VirtualDom { }); } // If an error occurs, we should try to render the default error component and context where the error occured - RenderReturn::Aborted(_placeholder) => panic!("Cannot catch errors during rebuild"), + RenderReturn::Aborted(placeholder) => { + log::info!("Ran into suspended or aborted scope during rebuild"); + let id = self.next_null(); + placeholder.id.set(Some(id)); + self.mutations.push(Mutation::CreatePlaceholder { id }); + } } self.finalize() diff --git a/packages/fullstack/examples/axum-hello-world/src/main.rs b/packages/fullstack/examples/axum-hello-world/src/main.rs index ccba37396..38d30ada0 100644 --- a/packages/fullstack/examples/axum-hello-world/src/main.rs +++ b/packages/fullstack/examples/axum-hello-world/src/main.rs @@ -16,12 +16,6 @@ struct AppProps { } fn app(cx: Scope) -> Element { - render! { - Child {} - } -} - -fn Child(cx: Scope) -> Element { let state = use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value(); @@ -52,7 +46,7 @@ fn Child(cx: Scope) -> Element { }) } -#[server(PostServerData)] +#[server] async fn post_server_data(data: String) -> Result<(), ServerFnError> { let axum::extract::Host(host): axum::extract::Host = extract().await?; println!("Server received: {}", data); @@ -61,7 +55,7 @@ async fn post_server_data(data: String) -> Result<(), ServerFnError> { Ok(()) } -#[server(GetServerData)] +#[server] async fn get_server_data() -> Result { Ok(reqwest::get("https://httpbin.org/ip").await?.text().await?) } diff --git a/packages/fullstack/examples/salvo-hello-world/src/main.rs b/packages/fullstack/examples/salvo-hello-world/src/main.rs index cc3288563..eed4362f4 100644 --- a/packages/fullstack/examples/salvo-hello-world/src/main.rs +++ b/packages/fullstack/examples/salvo-hello-world/src/main.rs @@ -16,12 +16,6 @@ struct AppProps { } fn app(cx: Scope) -> Element { - render! { - Child {} - } -} - -fn Child(cx: Scope) -> Element { let state = use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value(); diff --git a/packages/fullstack/examples/warp-hello-world/src/main.rs b/packages/fullstack/examples/warp-hello-world/src/main.rs index cc3288563..eed4362f4 100644 --- a/packages/fullstack/examples/warp-hello-world/src/main.rs +++ b/packages/fullstack/examples/warp-hello-world/src/main.rs @@ -16,12 +16,6 @@ struct AppProps { } fn app(cx: Scope) -> Element { - render! { - Child {} - } -} - -fn Child(cx: Scope) -> Element { let state = use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();