Skip to content

+layout.server.ts not re-running after slug change #6257

Closed
@HegarGarcia

Description

@HegarGarcia

Describe the bug

When changing slug in a route, the +page.server.ts gets called but the +layout.server.ts doesn't event though in depends on the params.

GIven a url structure: /foo/[baz].

When going from /foo to /foo/abc:

  • foo/[baz]/+layout@.server.ts#load doesn't run
  • if a foo/+page.server.ts exists, then foo/[slug]/+page.svelte will receive it's return value

When going from /foo to /foo/abc to /foo/xyz:

  • foo/[baz]/+layout@.server.ts#load doesn't get executed
  • if a foo/+page.server.ts exists, then foo/[slug]/+page.svelte will receive the same props no matter how many slug changes are performed

When accessing directly /foo/abc

  • foo/[baz]/+layout@.server.ts#load gets executed

When accessing directly /foo/abc then go the /foo/xyz

  • foo/[baz]/+layout@.server.ts#load gets executed on /foo/abc
  • foo/[baz]/+layout@.server.ts#load doesn't get executed when routing to /foo/xyz

This happens no matter if you are using <a> or the goto function.

Reproduction

Reproduction

From the landing page, follow the link between the pages and see the output of each page.

Logs

No response

System Info

System:
  OS: macOS 12.5.1
  CPU: (8) arm64 Apple M1
  Memory: 224.58 MB / 16.00 GB
  Shell: 5.8.1 - /bin/zsh
Binaries:
  Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
  Yarn: 1.22.15 - ~/.nvm/versions/node/v16.16.0/bin/yarn
  npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Browsers:
  Chrome: 104.0.5112.101
  Safari: 15.6.1
npmPackages:
  @sveltejs/adapter-auto: next => 1.0.0-next.66 
  @sveltejs/kit: 1.0.0-next.436 => 1.0.0-next.436 
  svelte: ^3.44.0 => 3.49.0 
  vite: ^3.0.8 => 3.0.8

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