Hi there,
we are unable to write a simple link using <a href=""> and passing query params, I do wonder if Gatsby rewrites for some reason the links strimming out the params.
We can't use from Gatsby since these are external links.
I looked in previous issues and I can't find much. Is this an expected behaviour?
Thanks
@aterreno what exactly does your a look like? Could you provide a reproduction?
We shouldn't be doing anything here to "re-write" any of your content, we rely on React serializing to HTML for much of this.
@DSchau I'll try to reproduce with a reproduction, the issue is similar to this https://github.com/gatsbyjs/gatsby/issues/9815 but in this case the answer was to use a
Reproduced! This is crazy! https://github.com/aterreno/gatsby-bug-repro
Try the app in local, it should work if you pass query params, then try the deployed version
https://stupefied-fermat-ce7a45.netlify.com/?channel=test
I wonder if it's possible that netlify strips for no reason the query params. Otherwise it must be the gatsby build...


One more finding: 100% not netlify fault, steps to reproduce:
yarn build
cd public
python -m SimpleHTTPServer 3000

To be clear, which link is manifesting the issue? Or are all of them?
Generally - GatsbyLink should not be used for _external_ links. It's for internal links to other pages within your application. If you open your console, you'll see warnings like "A page not found for
As far as the search params, I _think_ that's an issue with hydration. The search param isn't known at build time, so you will likely want to tap into componentDidMount to grab the search params and update them statefully.
Does that make sense?
@DSchau spot on, thanks a lot, it's now fixed and working.
Woo hoo!
Glad to hear it :) Closing this out.
Thanks for using Gatsby 馃挏
This is very confusing issue, I faced the same one and it was not obvious at all to use componentDidMount for that :(