Ask HN: How does HN preserve state so well?
I'm a bad tab hoarder and I have >500 tabs in my backlog, across many devices. One thing I've notices is that if I open an article from HN, if the <Back> button leads back to the HN homepage, it preserves the state exactly where I left HN opened at.
Maybe I haven't been on the static web in too long, but my memory is of pages refreshing whenever you hit back after some amount of time. Do they have a longer cache option? I don't see anything in their JS that suggests saving state.
3 comments
[ 2.6 ms ] story [ 19.9 ms ] threadIt's a modern anomaly with JS frameworks that we've hacked and over-stretched the DOM so far past its original design that basic things like going forward/back need explicit JS handlers that rarely work all that well. You shouldn't need any state in JS to store basic navigation. It didn't used to be that way, and arguably shouldn't be that way for simple text-based sites like this. Maybe it's just becoming a lost art these days =/