Skip to content

Default values for function props prevents reactivity when passed to child components #16473

@w-charlton-virifides

Description

@w-charlton-virifides

Describe the bug

If you have some component that takes a function as a prop and passes that on to child components, when the component provides a default value for that prop, changing the value of the prop will trigger reactivity with that component but will not trigger reactivity within any child components. This does not occur if the prop is a string type, for example, or if a default is not specified. This behaviour is the case regardless of whether the default value is ever used.

This manifested as fairly subtle failure in our usecase and took some time to isolate.

Reproduction

https://svelte.dev/playground/1bdd3298b7574da5bffe6a21ef8b6086?version=5.36.13

Logs

System Info

System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple M1
    Memory: 138.28 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.0.2 - ~/.local/state/fnm_multishells/91717_1753180887181/bin/node
    npm: 11.4.2 - ~/.local/state/fnm_multishells/91717_1753180887181/bin/npm
  Browsers:
    Chrome: 138.0.7204.158
    Safari: 18.5
  npmPackages:
    svelte: ^5.0.0 => 5.36.13

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