Skip to content

params becomes empty object ({}) after any async work #17079

@sillvva

Description

@sillvva

Describe the bug

params becomes {} after any async work

<script>
  const { params } = $props();

  console.log(params); // { slug: 'test-1' }
  await Promise.resolve()
  console.log(params); // {}
</script>

This bug was introduced in 5.42.0. Still present in 5.43.0

Reproduction

Steps to reproduce:

  1. Open the browser console
  2. Hover either link and observe the console

https://stackblitz.com/edit/sveltejs-kit-template-default-b5xxkxnj?file=src%2Froutes%2F%2Bpage.svelte,src%2Froutes%2F[slug]%2Ftest.remote.ts,src%2Froutes%2F[slug]%2F%2Bpage.svelte

Logs

✅ First remote function call:
test-1

❌ Second remote function call, with the same parameter:
Remote function schema validation failed: [
  {
    kind: 'schema',
    type: 'string',
    input: undefined,
    expected: 'string',
    received: 'undefined',
    message: 'Invalid type: Expected string but received undefined',
    requirement: undefined,
    path: undefined,
    issues: undefined,
    lang: undefined,
    abortEarly: undefined,
    abortPipeEarly: undefined
  }
]

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    svelte: 5.42.0 => 5.43.0 
    @sveltejs/kit: 2.48.3 => 2.48.3

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions