Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_infinite_scroll stops calling on_load_more after shrinking content #122

Open
Reisz opened this issue Jun 24, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Reisz
Copy link

Reisz commented Jun 24, 2024

In the following example, the scroll area initially populates and updates as expected, but pressing reset while the scroll is at the top will cause the updates to stop.

let (count, set_count) = create_signal(1);
let reset = move |_| set_count(1);

let data: &_ = (0..1000).collect::<Vec<_>>().leak();
let elements = move || data.iter().copied().take(count()).collect::<Vec<_>>();

let scroll_area = create_node_ref();
let _ = use_infinite_scroll(scroll_area, move |_| {
    std::future::ready(set_count(count.get_untracked() + 1))
});

view! {
    <button on:click=reset>Reset</button>
    <div style="height: 20rem; overflow-y: auto" ref=scroll_area>
        <For each=elements key=|id| *id children=move |id| view! { <div>{id}</div> }/>
    </div>
}
@maccesch maccesch added the bug Something isn't working label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants