Skip to content
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

[🐞] SSG Link componet strips search parameters #6753

Open
handymenny opened this issue Aug 2, 2024 · 4 comments
Open

[🐞] SSG Link componet strips search parameters #6753

handymenny opened this issue Aug 2, 2024 · 4 comments
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@handymenny
Copy link

handymenny commented Aug 2, 2024

Which component is affected?

Qwik City (routing)

Describe the bug

Since qwik 1.7.0, Link component strips search parameters.

For example:
Static adapter origin is http://localhost:9999

  • I click a Link that should route to http:/localhost:9999/view?id=42 -> it will route to http:/localhost:9999/view
  • I click a Link that should route to http:/127.0.0.1:9999/view?id=42 -> it will route to http:/127.0.0.1:9999/view?id=42

I would expect both links to route to [scheme]://[origin]:[port]/view?id=42

Reproduction

https://github.com/handymenny/qwik-ssg-link-bug/

Steps to reproduce

System Info

System:
  OS: Windows 11 10.0.22631
Binaries:
  Node: 20.15.1
  npm: 10.2.5
Browsers:
  Edge: Chromium (127.0.2651.74)

Additional Information

Versions affected:

  • 1.7.0
  • 1.7.1
  • 1.7.2
  • 1.7.3

Versions not affected:

  • 1.6.0
  • 1.5.x
@handymenny handymenny added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Aug 2, 2024
@wmertens
Copy link
Member

wmertens commented Aug 2, 2024

  • does also this happen with spa navigation?
  • does the HTML contain the search string in the <a> tag?

@handymenny
Copy link
Author

handymenny commented Aug 2, 2024

  • does the HTML contain the search string in the <a> tag?

Yes. This is the link that works:

<a href="http://127.0.0.1:9999/view/?id=42" q:key="AD_1">
<!--qv q:s q:sref=7 q:key=-->
http://127.0.0.1:9999/view/?id=42
<!--/qv-->
</a>`

This is the link not working:

<a q:link="" href="/view/?id=42" data-prefetch="" on:click="#0
q-DhbmnlE1.js#s_pIf0khHUxfY[0 1 1 1]" on:mouseover="q-DhbmnlE1.js#s_Osdg8FnYTw4" on:focus="q-DhbmnlE1.js#s_Osdg8FnYTw4" on:qvisible="q-DhbmnlE1.js#s_Osdg8FnYTw4" q:key="AD_1" q:id="9">
<!--qv q:s q:sref=8 q:key=-->
http://localhost:9999/view/?id=42
<!--/qv-->
</a>

  • does also this happen with spa navigation?

I'm using Link, so it should already be SPA navigation, or am I wrong?

useNavigate() has the same issue, raw html anchors don't have this issue.


One workaound I have found is to use a url that isn't exactly the right one as the origin of the static adapter.
For instance, http://abc.xy vs https://abc.xy.
The only side effect is that the canonical urls and the sitemap change.

@wmertens
Copy link
Member

wmertens commented Aug 2, 2024

Sorry I meant, does it work with regular SSR, not SSG?

@handymenny
Copy link
Author

handymenny commented Aug 2, 2024

Yes. I tried with nodejs adapter and it works.

This is the command I ran (powershell):

$env:ORIGIN='http://localhost:9999'; $env:PORT='9999'; npm run serve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants