Skip to content

$derived exposed through property not necessarily updating #15248

@brunnerh

Description

@brunnerh

Describe the bug

I tried to eliminate an $effect that writes a $derived value to a property by wrapping the derived access in a property. The $derived values appear to run initially but not when dependencies are updated.

Reproduction

I tried to make a simpler reproduction from scratch but could not reproduce the issue that way.

Core diff in node.svelte code
-  $effect.pre(() => result = derivedResult);
+  result = {
+    get current() { return derivedResult },
+  };
 </script>
 
 <div>
@@ -35,7 +37,7 @@
             bind:content={content.children[i]}
             bind:result={
               () => undefined,
-              v => childResultMap.set(child, v)
+              v => childResultMap.set(child, v.current)
             }
           />
         </li>

Logs

System Info

REPL

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