-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Having to manually reset loaderState #6
Comments
Hi, did u find some other package for Svelte for infinite loading? Having this problem too, can't really use multiple instances with this package. |
Hey sorry missed this until now. I think resetting it onDestroy makes sense and doesn't require any additional work on the users part. I'll add this this week 🙏 |
Hi, do you have any plans to implement the option where each |
Great to hear! And like @shumadrid mentioned it would be cool if you could consider adding the ability to optionally have a separate |
Especially since the only other infinite loading package is svelte-infinite-loading, and that one isn't for Svelte 5. |
Describe the bug
When you have multiple pages that each have an
InfiniteLoader
in them, you have to manually reset theloaderState
to ensure the infinite loader will work after navigation, as the page you were on could've calledloaderState.complete
.For now I've worked around this by calling
loaderState.reset
in theonNavigate
lifecycle.I've made a reproduction in svelte playground, due to routing not being available in the playground, I've simulated the behaviour by having two components that will conditionally mount/unmount.
As a potential fix, resetting could be implemented in the
onDestroy
ofInfiniteLoader.svelte
, or perhaps aloaderState
should be created by the user and passed to theInfiniteLoader
, so that not the sameloaderState
is being used. Which could also introduce being able to use multiple infinite loaders on the same page.Reproduction
https://svelte.dev/playground/eac5ad4404344f31912b9073c76b5a21
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: