Closed kevinresol closed 4 years ago
I dunno what is Measurement based observable tbh. But I am having issue with a observable that has a very deep and broad dependency in coconut.data
My code is something like this:
@:observable var list:List<...>;
@:computed var count:Int = list.count(v -> v.observableBool);
the list is of size ~100 and each of the observableBool
depends on another 2-3 observables.
and I got the error from AutoObservable (the error message is: no result after N attempts) rather than SimpleObservable
Hmm. That's odd.
Basically, when recomputing, the logic goes something like this:
while (!valid) {
valid = true;
computation();
}
So if the computation invalidates the result, it is rerun. Ideally, computations have no side effects, and therefore do not invalidate anything. Sometimes, it's more practical to do that, but if it happens >100 in a single observable, something is weird, either in tink_state or in your code ^^
Is there a way to know what is being invalidated and causes the rerun? I don't think I have code that invalidate stuff during computation...
Fine by me. That said,
Measurement
based observables have relatively poor performance characteristics, so you may want to avoid them ;)