Skip to content

Instantly share code, notes, and snippets.

@dy
Last active November 14, 2025 17:13
Show Gist options
  • Select an option

  • Save dy/4ed22461c5b5e43c2c3aceb0330d2945 to your computer and use it in GitHub Desktop.

Select an option

Save dy/4ed22461c5b5e43c2c3aceb0330d2945 to your computer and use it in GitHub Desktop.
Signals gotchas

from https://x.com/_developit/status/1722346883568357856?s=20

  1. Untracked function untracked(fn) { computed(fn).peek()}
  2. flushSync - read signal value to run all dependent effects
  3. Bump function bump (s) {let _ = s.value; s.value = undefined; s.value = _ }
  4. Trigger effect const s = signal(0), c = 0; const trigger = () => (s!=c?s.value++:c=s.value); effect(trigger)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment