Skip to content

invalidating layout load function on mount makes it so that layout load function reruns on any preload until clicked #10457

Description

@nasheomirro

Describe the bug

When using invalidate() inside an onMount(), the layout load function that was invalidated now runs every time sveltekit preloads pages. In the reproduction link below every time I hover on a pre-loadable link it will also run the layout load function. Once we click a link though the bug seemingly disappears.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-7tjszr?file=src%2Froutes%2F%2Blayout.svelte

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 4600H with Radeon Graphics
    Memory: 1.91 GB / 3.51 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
    npm: 9.7.2 - ~/.nvm/versions/node/v18.16.1/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.20.4 => 1.22.3 
    svelte: ^4.0.5 => 4.1.1 
    vite: ^4.4.2 => 4.4.7

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