Skip to content

Stuff is not correctly set when a load function returns error #5537

@flavioosh

Description

@flavioosh

Describe the bug

When error (or status !== 2xx) is included in the returned object from a load function inside a route, while also providing a stuff object, the $page.stuff store is empty.

Reproduction

https://github.com/flavioosh/sveltekit-stuff-error-repro

Logs

No response

System Info

System:
    OS: Linux 5.18 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
    Memory: 23.23 GB / 31.27 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    npm: 8.14.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Firefox: 102.0.1
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.60 
    @sveltejs/kit: next => 1.0.0-next.374 
    svelte: ^3.44.0 => 3.49.0 
    vite: ^3.0.0 => 3.0.0

Severity

serious, but I can work around it

Additional Information

I'm not sure if this is expected behaviour, but it seems that even if the object returned from a load function contains either error or a non-200 status, we should still get the stuff passed through to the layout or error pages. I'm not sure if I'm doing something wrong but this seems counter-intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedPRs welcomed. The implementation details are unlikely to cause debateload / layout

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions