Add href function support for search params #13273
discoverlance-com
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment, when using the href function and you want to add search params, there's no support for it so you have to still resort to string interpolation.
Even when you want to add the search params in the path of the href param, it does not work
I will propose we support search params as part of the core functionality of the function.
We could either, basically accept multiple params in the second argument of the href function, use the current page params in forming the url and then turn any extra params into search params.
I wonder how this can be achieved though as it will mean that the function has to be aware of what params are part of the page url, use those to form the url and then make the rest search params.
If that's not possible, then I think we can always accept a third parameter in the href function that can be used for search...
That also might break the current href functionality (in typecheck) as it looks like typescript is used to basically require the param if the url requires or has params so perhaps the second object for passing params can be optionally null so we can use
href('/search', null, { name: 'doe' })
Beta Was this translation helpful? Give feedback.
All reactions