Skip to content

Using a $state variable in an inner object of derived strips reactivity #16804

@Spartan1776

Description

@Spartan1776

Describe the bug

Hello,

It appears that when creating an object with $derived that contains an inner object where a field is from a $state variable, the access is no longer reactive.

Reproduction

https://svelte.dev/playground/untitled?version=5.39.3#H4sIAAAAAAAAE6WQwW7CMBBEf8VacQCpCqJHkyD1I3rCHJx4aS3MYsVLoIr876wTDhy49WTNjHee1yOQPSNo-Cb2HNDBBxx9wAR6PwL_xZIVQ_znza8YqzRg4OK1NuE7v7sQI7HUQJ263kdWwdJPY4CTgZ0hIzBWjIk3qlGLxJZxyf0VV9vX8LOEDns_oFuOJTHsibDX6qkMDzbouWl2cjnyylC9ntEFR7WneJVSWUle0f1id2ovdwOq9eT0pNE14wStJkQlxVmtd_-Zla9gvDPoslo-iLI-3GQK9NGGhPkBhGw9LIEBAAA

Logs

System Info

System:
    OS: macOS 14.6.1
    CPU: (16) arm64 Apple M3 Max
    Memory: 30.92 GB / 128.00 GB
    Shell: 4.0.2 - /opt/homebrew/Cellar/fish/4.0.2/bin/fish
  Binaries:
    Node: 24.1.0 - /opt/homebrew/bin/node
    npm: 11.3.0 - /opt/homebrew/bin/npm
    pnpm: 10.15.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 140.0.7339.133
    Safari: 17.6
  npmPackages:
    svelte: ^5.39.3 => 5.39.3

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