Description
Describe the bug
This is a tricky one to explain.
When you push commits to non-Main branches, Vercel creates deployments off of those branches. When you run those deployments, for some reason there's a network request fired off on all requests (as far as I can tell) with the http verb OPTIONS. This happens only with non-main (ie feature branch) deployments, not with the main deployment off of Master (Main).
When these OPTIONS requests happen, the loader functions run. @Rich-Harris tells me the loaders should not run under these circumstances, and asked me to repro. Here's the repro. (whether the OPTIONS request itself is supposed to happen at all I'm still not clear on).
This is a straight clone of the default SvelteKit project. I added a shared loader to the root page (and shut off prerender).
https://github.com/arackaf/sveltekit-options-loader-bug
After deploying to Vercel, and then pushing to some non-Main branch, opening that deployment, and then looking at the logs, I see those OPTIONS requests, and logging happening from the loader on them.
Reproduction
See above
Logs
See above
System Info
System:
OS: macOS 13.2.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 33.35 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/Cellar/nvm/0.38.0/versions/node/v16.14.2/bin/node
npm: 8.18.0 - ~/Documents/node_modules/.bin/npm
Browsers:
Chrome: 110.0.5481.177
Firefox: 110.0
npmPackages:
@sveltejs/adapter-auto: ^2.0.0 => 2.0.0
@sveltejs/kit: ^1.5.0 => 1.8.5
svelte: ^3.54.0 => 3.55.1
vite: ^4.0.0 => 4.1.4
Severity
annoyance
Additional Information
No response