sveltejs / sveltejs/kit

When I click on a nested link in Kit I get two `afterNavigate` calls

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

Nobody has claimed this yet.

router
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

I found what I think is a bug: when I click on a nested link in Kit I get two afterNavigate calls.

Reproduction steps:

  • open the reproduction

  • when it starts open the browser's console

  • delete all the messages in console

  • click on "Players"

  • an "afterNavigate()" is printed in the console

  • click on "Teams"

  • TWO "afterNavigate()" are printed in the console

Why TWO of them?

I expect only one.

This is a source of a bug in one of my app.

System Info
"@sveltejs/adapter-static": "3.0.8",
    "@sveltejs/kit": "2.21.5",
    "@sveltejs/vite-plugin-svelte": "5.1.0",
    "svelte": "5.33.19",
    "svelte-check": "4.2.1",
    "typescript": "5.8.3",
    "vite": "6.3.5"
Severity

blocking all usage of SvelteKit

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 StackBlitz reproduction and inspect the navigation lifecycle around nested Players → Teams clicks, using the browser console to confirm callback counts. Done means the Teams navigation produces exactly one afterNavigate call without regressing the Players navigation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.