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
Thanks for this fantastic library. Love the elegance of your approach. However, I ran into some difficulty when needing to swap content or redirect based on the outcome of a form submission (similar case to #79)...
PR #84 introduces a special handling for a _self target on a 3xx redirect:
Any 3xx class status code redirecting to a different page will load the redirected URL in the browser window
Any 3xx class status code redirecting back to the current page will target my_form.
This makes the behaviour dependant on the order of query params in the current URL and the response location header. If the order differs, this behaviour no longer applies.
If the current page was reached via a form (as in my case), the order of query params depends on the order of form fields. In my case I was able to solve this by sorting my data and using hidden form fields. But that adds complexity and implicit dependencies that could be avoided by comparing the URL queries as Maps.
The meaning of query parameters should generally be order independent.
The text was updated successfully, but these errors were encountered:
Hey! Thanks for the clear explanation. I totally agree, we need a more robust comparison method.
I’ve got some time set aside today to work down a few issues, this is on my priority list.
Awesome. Thanks! I wonder if would make sense just to leave out the query params entirely for the purposes of matching the current page. The base path is usually the significant part for routing.
@lachlancotter you’re right, in that case, I think we can do away with the sameURL and stripTrailingSlash functions and simply compare pathname for equality. That seems to be consistent with how my browser’s URL bar handles sameness.
Thanks for this fantastic library. Love the elegance of your approach. However, I ran into some difficulty when needing to swap content or redirect based on the outcome of a form submission (similar case to #79)...
PR #84 introduces a special handling for a
_self
target on a3xx
redirect:However the URLs are compared as strings:
This makes the behaviour dependant on the order of query params in the current URL and the response location header. If the order differs, this behaviour no longer applies.
If the current page was reached via a form (as in my case), the order of query params depends on the order of form fields. In my case I was able to solve this by sorting my data and using hidden form fields. But that adds complexity and implicit dependencies that could be avoided by comparing the URL queries as Maps.
The meaning of query parameters should generally be order independent.
The text was updated successfully, but these errors were encountered: