Skip to content

Instantly share code, notes, and snippets.

@marvinhagemeister
Created September 11, 2022 12:40
Show Gist options
  • Save marvinhagemeister/0d88f57db298dc8284f34aa1c689b157 to your computer and use it in GitHub Desktop.
Save marvinhagemeister/0d88f57db298dc8284f34aa1c689b157 to your computer and use it in GitHub Desktop.
usignal diamond scenario
import { signal, computed, effect } from "../esm/index.js";
const a = signal(1);
const b = computed(() => a.value);
const c = computed(() => a.value);
const d = computed(() => b.value + c.value);
effect(() => console.log(d.value));
a.value = 2; // Should log 4, but logs 2
a.value = 3; // Should log 6, but logs 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment