-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: ISR support for adapter-vercel
#9063
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line 223 (previously 215) there's a special handling for the common case of a single group. I think the if-condition needs to be adjusted here to also check that there's no ISR config. Because if the functions
isn't set there, ISR will not picked up (functions
is just empty). This could happen if you set IRS at the adapter level.
Co-authored-by: Simon H <[email protected]>
packages/adapter-vercel/index.js
Outdated
const name = functions.get(pattern); | ||
if (name) { | ||
static_config.routes.push({ src, dest: `/${name}` }); | ||
functions.delete(pattern); | ||
const isr = isr_config.get(route); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't have any route config, we'll never get into here because functions
is empty (because of line 216)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch. fixed
We shipped incremental static regeneration on Vercel last week, but it was broken. Turns out there were a few extra hoops to jump through.
Brief explanation of the changes:
group
, so that if you invalidate/foo
you simultaneously invalidate/foo/__data.json
— this is assigned automatically__pathname
query parameter.req.url
is reconstructed byadapter-vercel
before the request is handed off to SvelteKit/foo
or/foo/__data.json
is being requested, while still allowing/foo
and/foo/__data.json
to be invalidate simultaneously, we need to create two Vercel routes for each SvelteKit route withisr
. To save space, these are symlinks rather than duplicatesPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.