Skip to content

$page.data does not get updated correctly #8157

@ivanhofer

Description

@ivanhofer

Describe the bug

If the data returned from load inside a +page.server.js ("page-X") has the same shape as the data returned inside its corresponding +layout.server.js, the $page.data does not get updated when routing from "page-X" to another page that does not have its own +page.server.js file.

As a workaround I'm currently just adding a random key to the return value of +layout.server.js.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-bcif9n?file=src/routes/page-2/+page.server.js

  1. toggle between the root and page-1 links a few time
  2. the heading at the top should update accordingly
  3. now toggle between root and the page-2 links
  4. the heading does not get updated when clicking on root
  5. now add other: 5 to the return object in /routes/+page.layout.js
  6. now toggling between root and page-2 works
  7. but toggling between root and page-1 does not update the heading

Logs

No response

System Info

Stackblitz

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions