can't reset createInfiniteScroll
hello, at our team we are trying to create infinite scrolling with filters with @solid-primitives/pagination with signal: createInfiniteScroll but we encoutered a problem:
You can't reset createInfiniteScroll cleanly, while you can clear all values like this:
batch(() => {
setPage(0);
setEnd(false);
setPages([]);
});
but this will result in running the fetcher with page=1 and then page=1 see video
In the stackblitz example there is also copy of createInfiniteScroll for debugging
Here is a minimal reproduction scenario: https://stackblitz.com/edit/solidjs-template-raszfy?file=src%2FApp.tsx
Do you please know how to fix it?
OskarMihalik
StackBlitz
Solid Infinite Scroll reset Demo - StackBlitz
A Solid TypeScript project based on @solid-primitives/pagination, solid-js, solid-transition-group, typescript, vite and vite-plugin-solid
2 Replies
Did you ever get this figured out? I think we are struggling with something similar...
i needed to change createComputed and add refetch, see the changed cade:
to reset infinite scroll call:
() =>{
batch(() => {
setPage(0)
setEnd(false)
setPages([])
})
// eslint-disable-next-line no-void
void refetch()
}
This should work but it was long time ago so I don't remember details.
In the end we moved to normal pagination 😄