How to store your app's entire state in the url
scottantipa.com
How to store your app's entire state in the url
1–10 of 416 posts
Re: How to store your app's entire state in the url
#2Also, another shout out to mermaidjs and flowchart.fun for also implementing similar url-based sharing.
Re: How to store your app's entire state in the url
#3Hey all, I made this post to show a technique that I'm using in my keyboard-centric flowchart editor [0]. I really love urls, and the power that they hold, and would love to see more apps implement little hacks like this. Also, another shout out to mermaidjs and flowchart.fun for also implementing similar url-based sharing. [0] https://www.knotend.com
Re: How to store your app's entire state in the url
#4https://www.typescriptlang.org/play
I'm mixed on it. It means it's mostly useless for having your own list of creations because you have to manually store the URLs (PITA) and you need to store them somewhere accessible if you want to repo the UX of the site actually storing them where you can more easily access them from anywhere.
Re: How to store your app's entire state in the url
#5Suppose that you have a hierarchy that was opened. Do you want to store all the hierarchy breadcrumbs in case you hit refresh, and reload all of them?
Furthermore, what about URLs to initiate an action from a particular context? If you refresh what should it show? It should show a dialog / lightbox above the page, showing the form / interface for filling out before taking this action.
Re: How to store your app's entire state in the url
#6If you don’t want to store anything on the server, why serve the static JS and HTML? You can embed them in the URL also.
In that cass the URL just becomes a local file.
You should store the file locally, along with all the data it embeds.
Or you can store the files on a CDN at the edge. The problem with the latter is that people can abuse the storage.
Really, the Web needs to be overhauled to have a topology more like a DHT, where you only have peering agreements with a few peers, and they cache the content temporarily when it is requested a lot. So no centralized servers at all.
Re: How to store your app's entire state in the url
#7Re: How to store your app's entire state in the url
#8A better idea is to use the URI fragment (the string after the # sign). It has the advantage of not having a size limit, and not needing to be sent all to the backend during the request. `window.location.hash` is your friend.
Re: How to store your app's entire state in the url
#9It’s actually difficult to do this in the UX. Suppose that you have a hierarchy that was opened. Do you want to store all the hierarchy breadcrumbs in case you hit refresh, and reload all of them? Furthermore, what about URLs to initiate an action from a particular context? If you refresh what should it show? It should show a dialog / lightbox above the page, showing the form / interface for filling out before taking…