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
When you have multiple pages that each have an InfiniteLoader in them, you have to manually reset the loaderState to ensure the infinite loader will work after navigation, as the page you were on could've called loaderState.complete.
For now I've worked around this by calling loaderState.reset in the onNavigate 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 of InfiniteLoader.svelte, or perhaps a loaderState should be created by the user and passed to the InfiniteLoader, so that not the same loaderState is being used. Which could also introduce being able to use multiple infinite loaders on the same page.
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: