fulcro

sheluchin 2024-09-22T13:09:05.258099Z

What options are available if I want to eliminate the RAD query params from my URLs without losing functionality? I'm experimenting with the route->url option for new-html5-history and it works great for letting me change the URLs to my liking, but I know the query params are used to track some state RAD depends on. I'm just not sure exactly what might be in there (selected-row from a report is one example) and where else it could be placed.

janezj 2024-09-23T14:35:38.448589Z

Without qparams https://gitlab.com/-/snippets/3641549

❤️ 1
sheluchin 2024-09-23T14:41:41.238599Z

Thanks for sharing, @jj974! Do you use this code in live projects?

janezj 2024-09-24T05:34:21.172209Z

It i used in one project, where i don't have query params. with-qparam-codec is more used. But it is not perfect because it duplicates path params in query params. https://gitlab.com/-/snippets/3641551

tony.kay 2024-09-22T13:56:15.868139Z

If you don't care about bookmarks, then just don't install the html5 history at all. The URL is only used to restore things on a reload of a page like bookmark or user reload

sheluchin 2024-09-22T14:45:18.081499Z

I definitely do care about bookmarks. That's essentially all I'm after here. I just don't want the bookmarks to be long and have stuff that's not human-readable. I can put together a mapping of URL patterns -> segments for both route->url and url->route to use. Would that not be sufficient to allow bookmarking? It's not obvious to me what functionality lost by doing it this way.

tony.kay 2024-09-22T15:55:39.177859Z

The only reason I do it the current way is I can transite/base64 encode all of the types that transit can that way, which is everything you could send over the network, and any type you install in Fulcro (e.g. local dates, etc.). That makes it a fully-transparent and “just works” system without the need for more extension points. If you want readable URL params, then yes, you’ll have to make your own plugin to encode/decode the URL pararms, and invent your own mechanism for type coercion. The URLs in many webapps are not human readable, and I personally think users really don’t care…some devs do, but even I just don’t care. The things I want to edit are right there in the UI, why mess with the URL?

tony.kay 2024-09-22T15:55:56.009229Z

but you can do what you want, of course! 😄

sheluchin 2024-09-22T22:27:46.754219Z

I agree but in this case it's not up to me. I've got two apps in the works and for both of them I'm being asked to make "clean" URLs. I don't think either position is unreasonable. A short URL without any query params at all (encoded or not) has a nice aesthetic. If you're receiving props and doing all the rendering from scratch yourself are the concerns still the same? ie are the query params still necessary to make it all work from there?