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

Routing endpoints missing searchParams #3778

Closed
timwis opened this issue Feb 8, 2022 · 1 comment · Fixed by #3780
Closed

Routing endpoints missing searchParams #3778

timwis opened this issue Feb 8, 2022 · 1 comment · Fixed by #3780

Comments

@timwis
Copy link

timwis commented Feb 8, 2022

Describe the bug

The new routing endpoints are great, but I think I've come across a bug. If you use goto to set a querystring/searchParam, the routing endpoint can't read the searchParam when using client-side routing. But it can if you refresh the page (server-side routing).

Reproduction

Use this basic reproduction on stackblitz.

  1. Click Open in a New Window at the top-right of stackblitz, since the built-in browser doesn't update the URL visibly
  2. Enter a value in the text box and submit the form (client-side routing)
  3. You'll see the querystring printed is blank, but the browser's URL contains a query string
  4. Refresh the page (server-side routing) and you'll see the querystring comes through
  5. Press back, then forwards (client-side routing), and you'll see it's blank again

I've left a couple lines commented out to illustrate the conditions under which it works as expected:

  • If you use a load function instead of a routing endpoint (uncomment the load function)
  • Or if you use a standard <form> submission, instead of goto (uncomment the <form> tag and comment out the one beneath)

Logs

No response

System Info

System: (note: reproduced the issue on stackblitz)
    OS: macOS 12.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 90.80 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.3.1 - /opt/homebrew/bin/node
    npm: 8.3.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 98.0.4758.80
    Firefox: 96.0.1
    Safari: 15.2
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0-next.17 => 1.0.0-next.17 
    @sveltejs/kit: ^1.0.0-next.260 => 1.0.0-next.260 
    svelte: ^3.44.0 => 3.46.3

Severity

serious, but I can work around it

Additional Information

My guess, not being familiar with sveltekit's codebase, is that the issue could be with how goto sets HTML5 history - perhaps it's not including the query/searchParams there. But that's a rather wild guess.

@CaptainCodeman
Copy link
Contributor

See #3777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants