What are Glitches?
a = 0, 1, 2, ...
b = a
c = a
d = b + c
d should be 0, 2, 4, ... but if, say, b updates and d sees this update before c updates then you can get incorrect values in d.Naive me would have d observe a and recalculate its value by recomputing b and c then.
Other naive but complexity indulging me would store a dependency graph and use this graph to determine when one should wait for a value to update.
Surely there must be an easier way?
I have a somewhat small implementation that transparently batches updates with queueMicrotask in this library (bruh): https://github.com/Technical-Source/bruh/blob/a829af9df9405b...
Another way to deal with it is explicitly not dealing with it, eg. saying it is only (inconsistent) UI and will go away in a millisec…