sveltejs / sveltejs/kit

Bug revalidating ISR routes with optional params on Vercel

Open
#13,728 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

I noticed that ISR routes with optional parameters were not being revalidated properly on Vercel.

After revalidating, refreshing the /route/[[params]] in the browser does show the fresh version. However, the stale version is still served when trying to navigate to it.

This isn't an issue with routes with [param] or no params at all.

Reproduction

https://kit-isr-demo.vercel.app
https://github.com/adrienpicard/kit-isr-demo

Revalidating routes with x-prerender-revalidate seems to only partially works on routes with optional [[params]]

Route A (no optional params) /route-a

  1. Load Route A in Tab 1
  2. Open the landing page in Tab 2 and click Invalidate
  3. Navigate to Route A from Tab 2, the page was invalidated ✅
  4. Refresh Tab 1, the page was invalidated ✅

Route B (with optional params) /route-b/[[myparam]]

  1. Load Route B in Tab 1
  2. Open the landing page in Tab 2 and click Invalidate
  3. Navigate to Route B from Tab 2, the page was not invalidated ❌
  4. Refresh Tab 1, the page was invalidated ✅
Logs

System Info
System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 211.48 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.3 - ~/.nvm/versions/node/v20.18.3/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.3/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.3/bin/npm
    pnpm: 9.7.0 - ~/.nvm/versions/node/v20.18.3/bin/pnpm
  Browsers:
    Chrome: 135.0.7049.96
    Edge: 135.0.3179.73
    Safari: 17.6
  npmPackages:
    @sveltejs/adapter-auto: ^4.0.0 => 4.0.0 
    @sveltejs/kit: ^2.16.0 => 2.20.7 
    @sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.3 
    svelte: ^5.0.0 => 5.28.0 
    vite: ^6.2.5 => 6.3.2
Severity

serious, but I can work around it

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 kit-isr-demo reproduction and compare navigation versus refresh for /route-a and /route-b/[[myparam]] after invalidation. Trace how x-prerender-revalidate handles optional parameters, and consider the issue done when navigation serves the fresh version as refresh already does.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.