Closed etinquis closed 3 years ago
There is never a guarantee about when or how many times the lambda will run. The only guarantee you will get is that anything attached to the output of the Lift
will only observe a single value in this case (as you are seeing). This shouldn't be a problem as all operators' lambdas should be (1) pure, (2) not throw exceptions, and (3) execute extremely quickly. Anything that doesn't match any of these 3 cases should be an "async" mapping by breaking out of the FRP network via a listener, running the process (optionally on a new thread if it is long-running), then pumping the result of that process back into a StreamSink
(via a Post
operation if a new thread was not created).
Ok, I'll give that a shot. Thanks!
I'm wondering whether the behavior I'm seeing with the following is as-expected:
When running this, I see the lift lambda runs twice and then the listen runs a single time with a value of
1
. The sampled cell value contains1
as well. I'd expect either the lift lambda only runs once (generating the1
value), or the listen lambda runs twice (once for1
and once for2
). In my use case,result
is an expensively-constructed object that I'm trying to track via the cell, but I'm not getting all the generated result values.