petalframework / petal_components

Phoenix + Live View HEEX Components
https://petal.build/components
MIT License
768 stars 84 forks source link

Pagination support encoded path #263

Closed mrdotb closed 9 months ago

mrdotb commented 9 months ago

Following #262 Finally it's not a good idea to encode the path first you have to split the query from the path and encode. Something like

uri = URI.new!("/team?page=:page")
iex(7)> URI.decode_query(uri.query)
%{"page" => ":page"}
iex(8)> query = URI.decode_query(uri.query) |> URI.encode_query()
"page=%3Apage"
iex(9)> %{uri | query: query} |> to_string()
""/team?page=%3Apage""

Instead I use a simple regex with a OR.

nhobes commented 9 months ago

Looks great. Many thanks for contributing! 🙌