Skip to content

Expressions inside {#if} blocks sometimes not correctly reactive to $derived properties of ES6 classes? #14846

Closed
@max-kamps

Description

@max-kamps

Describe the bug

In very specific circumstances (see reproduction playground), expressions inside of #if blocks referring to $derived properties of ES6 classes are not reactive.

Expected behavior: Clicking the "Set to 999" button always changes the "Associated Data" and "Associated Data inside the {#if}" rows to the same value, and changes the status line to green.

Actual behavior: Clicking the "Set to 999" button for the first time only changes the "Associated Data" row, while the "Associated Data inside the {#if}" row does not change and the status line remains red.
Only repeatedly clicking between "Set to null" and "Set to 999" eventually produces the expected result.

Apologies if this is user error, but the conditions for this occurring are so specific I have to believe it's a bug! 😄 Playground code was produced by painstakingly deleting code from my project until only a single file remained. Unfortunately I am not knowledgeable enough about Svelte internals to investigate this any further.

Reproduction

https://svelte.dev/playground/55439f2d8d8b47e386fafadac3b2c3ec?version=5.16.0

Logs

No response

System Info

System:
    OS: Linux 6.12 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon  780M Graphics
    Memory: 17.45 GB / 30.66 GB
    Container: Yes
    Shell: 5.2.37 - /bin/bash
  Binaries:
    Node: 23.4.0 - ~/.nvm/versions/node/v23.4.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.4.0/bin/npm
  npmPackages:
    rollup: ^4.29.1 => 4.29.1

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