Skip to content

Root +layout.server.ts load function is called twice with Chrome dev console open #14887

@IcyFoxe

Description

@IcyFoxe

Describe the bug

I've noticed that my fetch calls in +layout.server.ts load function are being called twice when the Chrome dev tools tab is open and page is refreshed. If it's closed, load function is being called only once.

This happens only if you have a root [...rest] route. Doesn't matter if it's +page.server.ts or +page.svelte.

When logging event.request.headers.get("sec-fetch-dest") in hooks.server.ts handle function, first log returns "document" and second one returns "empty".

Reproduction

https://github.com/IcyFoxe/sveltekit-double-load-call

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 10.07 GB / 31.90 GB
  Binaries:
    Node: 24.4.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 142.0.7444.59
    Edge: Chromium (130.0.2849.80)
    Firefox: 144.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.19041.5794
  npmPackages:
    @sveltejs/adapter-node: ^5.4.0 => 5.4.0
    @sveltejs/kit: ^2.47.1 => 2.48.4
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.41.0 => 5.43.3
    vite: ^7.1.10 => 7.1.12

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions