preact-www
preact-www copied to clipboard
REPL: Bug with `effect` & `useSignalEffect` tracking
Not quite sure of the cause & don't have time to chase it down yet, but the tracking of dependencies in effect and useSignalEffect seems to be a bit broken in the context of our REPL. For example, here's a lazy effect:
import { signal, effect, useSignalEffect } from '@preact/signals';
const count = signal(0);
const initialized = signal(false);
effect(() => {
count.value;
if (!initialized.peek()) return initialized.value = true;
console.log(count.value)
});
count.value++;
The effect here will not subscribe to count, even though it's explicitly accessed. Swapping that to count.value.toString() works, however.