I was comparing the algorithm with this test and I encountered something I didn't understand. I hope someone can help me understand.
What happens in the test is:
- there is a
Signal.State
- there is a
Signal.Computed whose computation uses above Signal.State
- the
Signal.Computed's get() is called, which leads to a get() on the Signal.State, but because none of this is watched, the Signal.Computed is not added to the sinks of the Signal.State (as per this rule).
- Now the
Signal.State's set() is called, but because it (i.e. the Signal.State) has no sinks, nothing happens. The Signal.Computed is not notified in any way.
- Now the
Signal.Computed's get() is called again, but because it (i.e. the Signal.Computed) does not know that any of its sources are dirty, it considers itself clean and does not re-run its computation callback
- And yet the callback is expected to have run again!
Am I missing something?
I was comparing the algorithm with this test and I encountered something I didn't understand. I hope someone can help me understand.
What happens in the test is:
Signal.StateSignal.Computedwhose computation uses aboveSignal.StateSignal.Computed'sget()is called, which leads to aget()on theSignal.State, but because none of this is watched, theSignal.Computedis not added to thesinksof theSignal.State(as per this rule).Signal.State'sset()is called, but because it (i.e. theSignal.State) has no sinks, nothing happens. TheSignal.Computedis not notified in any way.Signal.Computed'sget()is called again, but because it (i.e. theSignal.Computed) does not know that any of its sources are dirty, it considers itself clean and does not re-run its computation callbackAm I missing something?