Skip to content

Conversation

@dummdidumm
Copy link
Member

This provides fetch as an argument to reroute, so that you can get the same benefits as the fetch provided to load functions from it. This is important (among other things) because else you might not be able to forward cookies on the server which influence where to go to.

The respond.js diff looks beefier than it is. Basically the event object is moved on top so that it's created before the reroute, because the fetch method passed to it needs to know about event. The biggest change is about cookies, which are now first created without knowing about the trailing slash, so setting new cookies (for which this is important) will wait until after a route is known.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.
This provides `fetch` as an argument to `reroute`, so that you can get the same benefits as the `fetch` provided to `load` functions from it.
This is important (among other things) because else you might not be able to forward cookies on the server which influence where to go to.
@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2025

🦋 Changeset detected

Latest commit: dc5eb94

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dummdidumm dummdidumm merged commit 78a794f into main Mar 7, 2025
18 checks passed
@dummdidumm dummdidumm deleted the reroute-fetch branch March 7, 2025 19:53
@github-actions github-actions bot mentioned this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants