Bugfix update for Cartograph - E2E Query Param Patching for LiveView
LiveView uses URI.decode_www_form for query params, which causes a literal plus sign in a param value to be converted to a space unless the query is first urlform encoded.
This change updates the query parsing logic used by cartograph_patch and cartograph_navigate to use URI.encode_www_form/1 on the keys and values of the generated query string instead of URI.encode/2 on the full query string.
We encode the keys and values individually because using URI.encode_www_form/1 on the full query string causes it to escape the equals signs, which causes Phoenix to parse the query string into a single key in the resulting map instead of all the key-value pairs we would expect.
Ran into this on my website after I added support for the Rebirth for You card game which uses plus signs for parallel rarities. I think this solution should be robust, but I only have one Elixir site running in production, so please open an issue on the GH repo GitHub - GrammAcc/cartograph: URI-Based Navigation for Phoenix LiveView · GitHub if the use of URI.encode_www_form/1 causes problems for your project. ![]()
Also, thanks @roflbobl for the doc formatting fix. Sorry for not getting that merged earlier. GH never notified me about the PR for some reason. ![]()
Unrelated to this release, but I have been using this lib in production on my website for about 5 months now without any issues (until this encoding problem), so I’m planning to bump to 1.0 sometime soon to acknowledge stability of the API. I’m in the middle of building a pretty significant feature for my website that will make heavy use of this lib, so I’ll wait until after that feature is working in production, but hopefully won’t be too far away. ![]()






















