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

Having to manually reset loaderState #6

Open
3 tasks done
Knyntsje opened this issue Nov 15, 2024 · 0 comments
Open
3 tasks done

Having to manually reset loaderState #6

Knyntsje opened this issue Nov 15, 2024 · 0 comments

Comments

@Knyntsje
Copy link

Describe the bug

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.

Reproduction

https://svelte.dev/playground/eac5ad4404344f31912b9073c76b5a21

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 7800X3D 8-Core Processor
    Memory: 19.71 GB / 31.75 GB

Used Package Manager

npm

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant