proposal-signals
proposal-signals copied to clipboard
Avoid creating a dependency edge when reading something which was written in the same computed?
trafficstars
@trueadm pointed out that the following would be an infinite loop in our current signal design, but is not one in most existing signal implementations:
createEffect(() => {
x.set(Math.random())
console.log(x.get())
})
Given that the write occurred before the read, there is no actual data dependency on the prior value of x. Should we avoid creating this false edge?
What would we expect from this?
const f = createComputed(() => x.get())
createEffect(() => {
x.set(Math.random())
console.log(f.get())
})
Are we looking for something that avoids these sorts of false edges in general, or just in the shallow/direct case?