sveltejs / sveltejs/kit

Group layout is ignored if user navigates with goto

Open
#13,701 0 comments 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

Describe the bug

I have a project with several groups with different layouts, and I noticed that if the user navigates from one page from one group to another page from another group with a different layout using the goto function, the second layout is ignored.

If the user navigates directly using the URL bar or instead of using the goto function, it uses a classic link with href or window.location the correct layout is loaded.

Reproduction

I created this small project with the following structure

routes
  '---> (app)
      '---> +layout.svelte 
      '---> +page.svelte 
  '---> (no-style)
      '---> +layout.svelte 
      '---> hi 
           '---> +page.svelte 

Link

If you click the button Navigate to another page it will go to the other page but it will not respect the layout of the group, it will still use the layout from the (app) group.

If you write /hi on the address bar directly, it will go to the other page using the right layout (no-style).

Image Image
System Info
System:
    OS: macOS 15.3.2
    CPU: (12) arm64 Apple M3 Pro
    Memory: 876.83 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    pnpm: 9.15.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Brave Browser: 135.1.77.97
    Chrome: 135.0.7049.42
    Safari: 18.3.1
  npmPackages:
    @sveltejs/adapter-auto: 6.0.0 => 6.0.0 
    @sveltejs/adapter-vercel: 5.7.0 => 5.7.0 
    @sveltejs/kit: 2.20.5 => 2.20.5 
    @sveltejs/vite-plugin-svelte: 5.0.3 => 5.0.3 
    svelte: 5.25.10 => 5.25.10 
    vite: 6.2.6 => 6.2.6
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 SvelteLab reproduction and the goto entry point, comparing navigation with direct URL, href, and window.location navigation. The work is done when navigating between the (app) and (no-style) groups loads the destination group's layout consistently; no source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
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.