You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The suspense API we currently have is functional, but it doesn't support choosing a placeholder to render while a component is suspended. Here is the same component with a few different suspense APIs
Baseline, no suspense
This doesn't support waiting for a future to render on the server which makes proper SSR difficult
#[component]fnDoggo() -> Element{letmut fut = use_resource(move || asyncmove{async_function().await});match fut.read_unchecked().as_ref(){Some(Ok(resp)) => rsx!{
button { onclick: move |_| fut.restart(), "Click to fetch another doggo"}
div { img { max_width: "500px", max_height: "500px", src: "{resp.message}"}}},Some(Err(_)) => rsx!{ div {"loading dogs failed"}},None => rsx!{ div {"loading dogs..."}},}}
A suspense component with error handling
This is fairly simple because it uses the existing component API, but it requires nesting for each suspended future
Specific Demand
When a component becomes suspended, we should hold the old elements while the suspense is running while the suspense is running.
Implement Suggestion
Instead of rendering nothing like the current suspense implementation does, we should render the button as normal until suspense if finished
The text was updated successfully, but these errors were encountered: