ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.55k stars 106 forks source link

Possible to leverage the routing to work with table pagination? #280

Closed JustBarnt closed 2 years ago

JustBarnt commented 2 years ago

Is it possible for the router to for table pagination so the user could use the next or back buttons in the browser or the associated keyboard commands to go back and forth in the history stack?

So far all my efforts result in a new page loading that doesn't exist.

ItalyPaleAle commented 2 years ago

Can you give an example of the routes you want to create? Are you asking about navigating within the same page?

JustBarnt commented 2 years ago

I am trying to get the back/forward buttons to work with a table that has pagination on it. I have a url for the table itself.

localhost:XXXX/#/licenses/1 <-- starting page for the table one page 1

When I hit the next button I created for the pagnination it updates the route localhost:XXXX/#/licenses/1and it will count up for each additional page.

But what I am trying to achieve is that hitting forward or back browser buttons or using the corresponding keybinds: "alt + arrow" it will go to the route and also show the correct data.

Which it current updates the url as expected like it does with the other pages. But it does not load the new data.

ItalyPaleAle commented 2 years ago

Could this be a similar issue to this? https://github.com/ItalyPaleAle/svelte-spa-router/issues/274

The idea is to make sure that there's something that's reacting to a parameter from the route. This way Svelte knows when to regenerate the page.

I think I need to add this to the docs.

JustBarnt commented 2 years ago

@ItalyPaleAle I will give this a try when I get into work today. Thank you!

JustBarnt commented 2 years ago

@ItalyPaleAle Sorry it took a couple days to get back to you, I had to refactor a bit and had some other things come up. But this indeed was a successful and easy solution now that I know what needs to be done. I will be closing this issue! Thank you.

ItalyPaleAle commented 2 years ago

Thanks for confirming!