Skip to content

$props() rune does not replace all usages of export let #13629

@Tortoaster

Description

@Tortoaster

Describe the bug

Svelte 5's new $props() rune does not retrieve data from the load function of +page.[js|ts]. This might be intended, but it's not immediately clear to me after reading the documentation. It's a nuisance because using export let for this purpose disallows using runes anywhere else in the page.

Reproduction

Given the following +page.js:

export async function load() {
    return { message: ':)' };
}

This +page.svelte works as expected (renders :)):

<script>
    export let data;
</script>

<div>
    {data.message ?? ':('}
</div>

However, the equivalent (?) Svelte 5 version does not:

-    export let data;
+    let data = $props();

Output: :(

Logs

No response

System Info

System:
    OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
    Memory: 19.74 GB / 30.50 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.3.0 - ~/.nvm/versions/node/v22.3.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.3.0/bin/yarn
    npm: 10.8.3 - ~/.nvm/versions/node/v22.3.0/bin/npm
    pnpm: 9.7.0 - ~/.nvm/versions/node/v22.3.0/bin/pnpm
    bun: 1.1.20 - ~/.bun/bin/bun
  Browsers:
    Chrome: 129.0.6668.100
  npmPackages:
    svelte: ^5.0.0-next.1 => 5.0.0-next.264

Severity

annoyance

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