timwis/github-feed

Going "back" to this site should persist how it looked when you left

Opened this issue · 1 comments

At the moment, going back is like starting over -- you lose your scroll position, the pages loaded, etc.

To accomplish this, I'm thinking we'll need to persist the events to local storage (ie. pouchdb), keyed by their id.

Open questions:

  1. How do we clear them out as they get old, or as new events take their place? No need to keep events from a week ago, they're just taking up space.
  2. I anticipate scroll position will still be a problem, considering going "back" to this page triggers firing a request to pouchdb. Maybe pushState data is the only true way to do this?

Update:
Yes, I think a good approach would be to use history.pushState. Clicking "next" might take you to /2 (change the route) and each route will save the events in pushState data.

Not sure pushState is the way forward here; pouchdb or even localstorage would be better. Perhaps we could maintain scroll position if we simply set <body>'s height to 99999px or something?

EDIT: Yep, this trick works.