Live data from Hacker News

How to store your app's entire state in the url

scottantipa.com

201–210 of 416 posts

Re: How to store your app's entire state in the url

#201

App state in URL can be a good idea, but if possible I prefer readable path/query parameters instead of unreadable base64 encoding. As one comparison, this is Google Finance encoding stock chart parameters: https://www.google.com/finance/quote/F:NYSE?window=5Y Versus Yahoo! Finance doing the same: https://finance.yahoo.com/quote/F/chart?p=F#eyJpbnRlcnZhbCI6IndlZWsiLCJwZXJpb2RpY2l0eSI6MSwidGltZVVuaXQiOm51bGwsImNhbmRsZ…

> https://finance.yahoo.com/quote/F/chart?p=F#eyJpbnRlcnZhbCI6... Dear god... this link was real. I thought it was like a joke or something

[deleted]

Re: How to store your app's entire state in the url

#205
post #114

Earlier quoted context omitted.

> https://finance.yahoo.com/quote/F/chart?p=F#eyJpbnRlcnZhbCI6... Dear god... this link was real. I thought it was like a joke or something

[flagged]

There are different languages. The jokes are symptomatic of the differences. I'm not Indian but English is laughable for many good reasons. Without damage...

Re: How to store your app's entire state in the url

#206
post #157

Earlier quoted context omitted.

Just because a thing is prevalent doesn't mean it's good. I have a hard time believing all those parameters are completely necessary for the amount of data being displayed. Often times it feels like people just base64encode(page.state) and call it a day. I think it's advantageous to keep the complexity and specificity of information in URLs to a minimum outside of what's needed to retrieve the data set as it can make…

> Just because a thing is prevalent doesn't mean it's good. I agree with this sentiment. I'm not sure I've ever seen a url referred to as "good", I was just a bit confused as to why someone would baulk at a URL. In my opinion everything after the host portion of the url is to serve the apps needs, so it knows where to go or what to do, it's not really an interface for the user as obviously there are better ways to pr…

I’d say everything after the host is part of the UX, and should serve the user needs. For example:

* Should be book-markable.

* If searching with a query, should have a clear query parameter for ease of browser integration.

* If the URL contains slash dividers that can be read as categories (e.g. storefront.com/department/category/product), then deleting everything after a given slash should go to that category’s page.

* The link should be short enough to be sent over a plain-text conversation without becoming a wall of text.

* The link should be short enough that it cannot hide a malicious subdomain (e.g. Google.com.flights.malicio.us/more/elements).

Re: How to store your app's entire state in the url

#207
This is the way. Except I would never encode the data—just store state in plain text. That way you can edit urls by hand in a pinch (comes up a lot, actually). And more trustworthy and you can be sure you take your data with you.

I do this in all my apps. https://ohayo.computer/, https://simoji.pub/, https://try.scroll.pub/, https://jtree.treenotation.org/designer/ etc.

At one point I also made a tiny lib to make it easier:

https://breckyunits.com/patch/

Re: How to store your app's entire state in the url

#208
post #37

Earlier quoted context omitted.

I am genuinely intrigued as to why that's better? Especially as in the second part of your comment you restrict shareability/usability significantly from what the author wants to achieve (IE I can't as a free user bash out a diagram and share it, then later do another and share with a different person). In fact the solution is so elegant when you think on it; free account volume is incredibly scalable, zero storage c…

> Especially as in the second part of your comment you restrict shareability/usability significantly no it doesn't. If my URL is `/thing#a1234` and I share it with you it will load my state for you. If you make a change, it's easy to push a new hash to the url that belongs to you. > I am genuinely intrigued as to why that's better? I didn't say it was better. We engineers are supposed to discuss solutions. I ended my…

not my fight, but you literally wrote:

> Seems like it could be better

Maybe you didn't mean it that way, but it does come across that way. Just a data point for you; I got no beef...

Post reply on HN