Skip to content

Question: why does this test pass? #278

@emilefokkema

Description

@emilefokkema

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions