Open dbrelovsky opened 3 months ago
It's due to the way that sets cascade through links, and it observes both the source and target to make sure it catches everything. So it observes the target (data$) changing and re-runs, and the same batch triggers obs$.b to re-run, which triggers the observer again. Better to observe too many times than miss it!
I think we can do better, but it will take a refactor of the way that listeners are notified. My current theory is to notify in waves of priority, where computed functions would have a high priority and observers would have a lower priority. Then the observe would be triggered once by both the target and computed changing. I hadn't planned for this linking functionality when I initially designed the notification system so it's not totally ideal for that scenario.
It will probably be a little bit until that project becomes a priority, although the optimizing instinct in me really wants to do it now 😅. I may end up tackling it on a long plane or train ride...
But I don't think should should be breaking anything or causing any real problems for now. But please let me know if you see any really bad side effects and we should prioritize it higher.
If a linked observable is accessed in observe(), the callback is executed twice.