You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Passing a query string like ?param=a¶m=b redirects the page (or rewrites the location) to ?param=b. This seems partially intentional since ParamsMap maps String to String, but as you can see in the example, serializing a form can itself produce multiple values.
Leptos Dependencies
leptos = { version = "0.6" }
leptos_axum = { version = "0.6", optional = true }
leptos_meta = { version = "0.6" }
leptos_router = { version = "0.6" }
To Reproduce
Steps to reproduce the behavior:
Clone shivjm/leptos-multi-value-params-mwe.
Run cargo leptos serve (or watch).
Open localhost:3000.
Check the boxes.
Click on Submit.
Note that the URL in the address bar and the query string provided by Leptos are correct but the ParamsMap is not.
Either refresh the page or navigate to the same URL.
Note that the URL in the address bar has dropped one value for the parameter.
Expected behavior
Multi-value parameters should be collected into a Vec or equivalent structure. I imagine this would have to be a breaking change since ParamsMap currently maps String to String.
Screenshots
The text was updated successfully, but these errors were encountered:
While I don’t see any way around changing the type of the underlying LinearMap (that could be considered part of the public interface), I think ParamsMap itself could continue to work the same way and simply add a get_all method. I don’t know what to do about insert, though; I guess it could get an append counterpart, and then the struct would probably need something like replace or set for replacing all the values of a parameter.
It looks like LinearMap got replaced for type ParamsMapInner = Vec<(Cow<'static, str>, String)> however ParamsMap still acts like a map and replaces existing keys.
Params of the same name are totally valid. Should we instead have something like, type ParamsMapInner = Vec<(Cow<'static, str>, Vec<String>)> then?
Describe the bug
Passing a query string like
?param=a¶m=b
redirects the page (or rewrites the location) to?param=b
. This seems partially intentional sinceParamsMap
mapsString
toString
, but as you can see in the example, serializing a form can itself produce multiple values.Leptos Dependencies
To Reproduce
Steps to reproduce the behavior:
ParamsMap
is not.Expected behavior
Multi-value parameters should be collected into a
Vec
or equivalent structure. I imagine this would have to be a breaking change sinceParamsMap
currently mapsString
toString
.Screenshots
The text was updated successfully, but these errors were encountered: