erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
611 stars 83 forks source link

Feature: allow for preservation of view in background #36

Closed belcherj closed 2 years ago

belcherj commented 9 years ago

When navigating between routes, app-router destroys the active view via removeRouteContent (line308). While this is good for memory management, the user experience suffers as routes need to be rebuilt each time.

It would be great to have the capability to preserve views in the background to enable a snappier UI. This could be accomplished through an attribute on app-router or app-route.

erikringsmuth commented 9 years ago

I just timed this and it looks like page transitions take ~40ms once the page is loaded. HTML Imports are cached and <temlate> tags are pre-parsed so navigating from page-a to page-b and back to page-a will take ~40ms from page-b back to page-a since it's already loaded and parsed.

Given that, it would probably be slightly faster transitioning from page-b back to page-a if page-a had only been hidden with CSS.

Things to note if you only use CSS:

It's probably something worth trying to code up. I don't know if I'll get around to it just yet.

rbjarnason commented 9 years ago

I was thinking about something similar for my app. Great work btw, love app-router :)

In my case I have a main page with a long list of cards, I want to be able to scroll way down, click on an item, go to the items page then return back to the previous page at the same position in the list.

Maybe I should not use app-router for this but I do want the individual item pages to have their own URL and be navigable to directly.

erikringsmuth commented 9 years ago

Hey @rbjarnason, The page history scroll position your talking about is one of the big difficulties with all client-side routers. At the same time it's something I'd love to get working. I'm going to have to do some research on this.

erikringsmuth commented 9 years ago

@rbjarnason I'm opening a separate issue to track the scroll position problem https://github.com/erikringsmuth/app-router/issues/46.

erikringsmuth commented 9 years ago

I started working on a branch to add this feature. Figuring out how to handle hiding and showing views along with all of the other valid flows in activateRoute() is making my brain melt. https://github.com/erikringsmuth/app-router/compare/hide-show-views

belcherj commented 2 years ago

Closing as this is likely not something that will happen.