Skip to content

LayoutServerLoad not re-fetched when page without PageServerLoad is invalidated #6258

Closed
@HalfdanJ

Description

@HalfdanJ

Describe the bug

In a simple project where theres a +layout.server.ts file and a +page.svelte, calling invalidate() doesn't re-trigger fetching the page data from +layout.server.ts again.

If an "empty" +page.server.ts file is added, then the data does get re-fetched when invalidated, including the data from +layout.server.ts.

I was able to determine that this was a regression in sveltekit 432 (#6174)

Reproduction

Reproduction example: https://stackblitz.com/edit/sveltejs-kit-template-default-voqrk9?file=src/routes/+page.svelte

The date shown in the example comes from +layout.server.ts. Every time invalidate button is clicked, it should show a new date, and re-fetch __data.json, but data is never fetched and the date doesn't update.

If a +page.server.ts file is added returning an empty object, then it does fetch new data when invalidated.

Changing the version of sveltekit to 431 in the example above solves the issues.

Logs

No response

System Info

System:
    OS: macOS 12.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 79.30 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 103.0.2
    Safari: 15.6
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.66 
    @sveltejs/kit: next => 1.0.0-next.435 
    @sveltejs/package: next => 1.0.0-next.1 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.0 => 3.0.9

Severity

serious, but I can work around it

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