ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.53k stars 105 forks source link

Option to render all routes and only display the one in use? #277

Closed mon closed 1 year ago

mon commented 2 years ago

I've got a bit of an odd case - I have a tabbed dashboard, and I want the user to be able to bookmark a particular tab, hence the use of SPA Router.

The page is very small, but the dashboards take a moment to render as they load a layout schema from the backend on mount.

It'd be very useful to render all the routes at once, and just display:none the ones not in use, so navigation is instant between tabs. Is something like this possible?

ItalyPaleAle commented 1 year ago

I don't think this is a feature I'd like to add, as it seems to address a very specific situation, sorry!

Most times, that would increase the resource requirements of the app. Also, mounting routes (even with display:none) could trigger things like components' onMount which may not be desirable.

mon commented 1 year ago

No problem! Thanks for the reply.