Replies: 1 comment
-
Would this question even be considered valid now? We dont do stores anymore do we? Isnt xyz.svelte.ts file the new store? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve created a custom store named createInfiniteScrollStore for handling infinite scroll in my SvelteKit application. Here’s the code for the store:
This store works well in a single route, but I encounter issues when I try to reuse it in a dynamic route setup.
Problem:
When I navigate between dynamic routes (e.g., /tech/[subCat]), the store does not reinitialize with the new initState. Instead, it retains the previous state, leading to incorrect data being displayed.
Here’s how I'm using the store in my dynamic route:
Question:
How can I ensure that the store reinitializes with the correct initState whenever the route changes? I want the store to reset and load new data based on the dynamic route parameter (subCat). What would be the best approach to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions