Last November I had covid and during that time I wrote a little pastebin that runs in the browser, compresses the paste data with Brotli, and puts it in the URL. It has line numbers, file naming, and syntax highlighting so it's feature complete for my own use. Here's a demo, but beware, the URLs are loooong: https://nicd.gitlab.io/t/#NhfW?Qm3F?6-&22c&CQZXuP+Aej5OXzXk7... I find it interesting to sometimes play around…
> The maximum URL size is 2048 FYI, this is almost entirely untrue. Maybe for some old versions of IE, but modern browsers can handle extremely long URIs
How to store your app's entire state in the url
411–416 of 416 posts
Re: How to store your app's entire state in the url
#412Earlier quoted context omitted.
Agreed. However they could still simplify the urls a ton by including only non-default parameters, and still achieve the same thing.
Everything in chart is customizable, so no, its not possible to achieve the same thing in the way you are saying
Re: How to store your app's entire state in the url
#413Earlier quoted context omitted.
Well yeah that's a major reason why most programmers hate LISP syntax. It uses a parentheses for everything even though every keyboard has round, square, angle and curly braces.
I somehow doubt it. I tutored quite a few people of all ages who started to learn programming, mostly C, C++ and Java - they all initially have been mostly confused by the different kinds of brackets. They quickly understood where the brackets go (scopes/blocks, function calls, array declarations and access, etc.), but took some time to internalize which bracket type is used in which context. I suspect the main reaso…
Re: How to store your app's entire state in the url
#414About 6 years ago I had to do this on a project. We had charts with a lot of options and we wanted them to be bookmarkable and shared between colleagues. We started with base64, soon moved to a custom encoding with version support https://github.com/ananthakumaran/u
I saw someone forked it and removed the lodash dependency / minor refactoring https://github.com/ananthakumaran/u/compare/master...j-te:u:...
Re: How to store your app's entire state in the url
#415This is a useful idea when you've got complex nested state. The problem is changing any particular part of the state is non-trivial. I ended up making `friendly-serializer`[0] to "make objects more accessible in urls." The idea is that instead of a base64 string, you get something that is much easier to edit in the url bar: > name=John%20Doe&age=42&address.street=123%20Main%20Street&address.city=Anytown&address.state…
You can have multiple values under the same search parameter. For example, ?a=b&a=c&a=d, which would be the array [b, c, d]. Including the index key seems redundant. The native URLSearchParams browser interface even supports this with the getAll method. https://developer.mozilla.org/en-US/docs/Web/API/URLSearchPa...
Re: How to store your app's entire state in the url
#416This is a useful idea when you've got complex nested state. The problem is changing any particular part of the state is non-trivial. I ended up making `friendly-serializer`[0] to "make objects more accessible in urls." The idea is that instead of a base64 string, you get something that is much easier to edit in the url bar: > name=John%20Doe&age=42&address.street=123%20Main%20Street&address.city=Anytown&address.state…