sveltejs / sveltejs/kit

Remote query with URL dependency is run again when navigating away via redirect

Open
#16,362 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

Given a page /foo with a remote query that has the page URL as input (e.g. page.url.searchParams.get("page")). When some other part of the page throws a redirect towards /bar, then the query is run again. The URL from getRequestEvent() confirms it is run for /bar even though it is not part of /bar.
The behaviour only shows with JS enabled. With JS disabled the query is not run an additional time.

Edit: turns out the dependency on the page URL isn't even really needed. I've just encountered an instance of a remote query without parameters that is rerun when navigating away via redirect.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-xkolyc4v?file=src%2Froutes%2Frepro%2F%2Bpage.svelte

Navigate to Repro, enter 'magic'

Logs

System Info
System:
    OS: macOS 26.5.2
    CPU: (10) arm64 Apple M2 Pro
    Memory: 71.72 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.1 
    npm: 11.17.0 
    pnpm: 11.10.0 
    @sveltejs/adapter-node: version: 5.5.7
    @sveltejs/kit: version: 2.69.3
    svelte: version: 5.56.5
  Browsers:
    Edge: 150.0.4078.65
    Firefox: 152.0.6
    Safari: 26.5.2
Severity

annoyance

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and follow the steps: enable JavaScript, navigate to Repro, and enter “magic.” Trace the remote query during the redirect to /bar, using getRequestEvent() to confirm the request URL. Done means the query is not run again for the destination URL, including for a parameterless remote query.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.