Fix the root error boundary during suspense in ssr (#4710)
* Fix the root error boundary during suspense in ssr * fix some typos
This commit is contained in:
1 parent
10912f4750
commit
ad40f81607
9 files changed
+49
-13
No files matched your search
@@ -30,6 +30,9 @@ enum Route {
|
||||
#[route("/error")]
|
||||
ThrowsError,
|
||||
|
||||
#[route("/async-error")]
|
||||
ThrowsAsyncError,
|
||||
|
||||
#[route("/can-go-back")]
|
||||
HydrateCanGoBack,
|
||||
}
|
||||
@@ -52,6 +55,20 @@ fn ThrowsError() -> Element {
|
||||
)));
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn ThrowsAsyncError() -> Element {
|
||||
#[server]
|
||||
async fn error_after_delay() -> ServerFnResult<()> {
|
||||
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
|
||||
Err(ServerFnError::new("Async error from a server function"))
|
||||
}
|
||||
|
||||
use_server_future(error_after_delay)?().unwrap()?;
|
||||
rsx! {
|
||||
"Hello, world!"
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Home() -> Element {
|
||||
let route: Route = use_route();
|
||||
|
||||
Reference in new issue
Block a user