-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve query param value if named route param nil #1676
Conversation
Optional named route params would overwrite a query param of the same name with nil if not included
Well, do we need to follow up on backward-compatibility between 1.4.x and 2.x? The current behavior looks reasonable to me. |
Good question, I don't know. I'm trying to think of a scenario where it would be necessary or easier to use query params instead of an optional named route parameter. Maybe the old behavior was accidental. @synecy would you like to weigh in on this? |
@namusyaka I'm thinking it might be a nice feature if I had to dynamically build links or form data to use query params, but also to have the option of creating direct links using the (optional) named route params. I suppose you could just create two separate routes if that was they case tho. One without the param and one with the named parameter being required. |
Should it be released as a new feature? I'm sorry, but I'm still thinking that the feature is not useful to me.. |
@namusyaka I honestly don't feel that strongly about this feature. I'm happy to close this PR and #1666 as a non-issue. I think if this was an issue, the workaround would be to just define an additional route without the optional named route parameters. |
If I recall, our use case was something like this:
which no longer works in 2.x, however we've since added workarounds by either adding multiple routes or manually copying from
the number of routes you have to add in order to support every possible case gets out of hand pretty quick. |
Hey thanks @namusyaka. As @dentarg mentioned, I have already created a 2.2.0 tag on master. |
I marked this as v3.0.0. Will cut a new release based on the v2.2.0 tag. |
Optional named route params overwrite a query param of the same name with nil if not included. Fixes #1666.