Redirect and single-flight mutations
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
When a remote form function rehreshes a query and then redirects, the query is fetched again after the redirect (if it is used on that page). I would have exptected it to use the fresh data retured from the form function after the redirect. If not, I guess there is no way to do single-flight mutation when using redirect.
Reproduction
https://www.sveltelab.dev/5uaeob2ogwsg968?files=.%2Fsrc%2Flib%2Fdata.remote.js
- Click edit
- Submit the form
- Notice the network traffic:
remote (contains data):
refreshes: "[{\"1t2evzh/data/\":1},{\"type\":2,\"data\":3},\"result\",3]"
data (is fetched anyway):
result: "[3]"
type: "result"
Logs
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 22.22.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.3.1
@sveltejs/kit: ^2.5.27 => 2.57.1
@sveltejs/vite-plugin-svelte: ^5.0.0 => 5.1.1
svelte: ^5 => 5.55.4
vite: ^6.0.0 => 6.4.2
Severity
annoyance
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked SvelteLab reproduction and inspect src/lib/data.remote.js, then observe the network sequence when the form refreshes a query and redirects. Trace how the refreshed data is handled across the redirect. Done means the redirected page reuses the fresh form data instead of fetching the query again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100