Skip to content

<For> inside of <Suspense> or <ErrorBoundary> #1664

Answered by gbj
smessmer asked this question in Q&A
Discussion options

You must be logged in to vote

Converting this to a discussion since, as you say, it's more of a question than a feature request.

Here's an example. Adding a log to the view function is useful as it will show you exactly when it rerenders. Using this simple version of your example, I demonstrated to myself that each row is only rendered once.

#[server(SomeData, "/api")]
pub async fn some_data(len: usize) -> Result<Vec<usize>, ServerFnError> {
    Ok((0..len).collect())
}

#[component]
pub fn App(cx: Scope) -> impl IntoView {
    let (count, set_count) = create_signal(cx, 3);
    let data = create_resource(cx, count, some_data);
    view! { cx,
        <button on:click=move |_| set_count.update(|n| *n += 1)>"+1"</button…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@gbj
Comment options

gbj Sep 6, 2023
Maintainer

@gbj
Comment options

gbj Sep 6, 2023
Maintainer

@smessmer
Comment options

@smessmer
Comment options

@gbj
Comment options

gbj Sep 7, 2023
Maintainer

Answer selected by smessmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1663 on September 06, 2023 20:22.