-
-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This library doesn't seem to be glitch free? #296
Comments
good point. no, |
Thanks for the quick reply, and reference to Indeed, sorry, I should have seen this is not a dataflow approach: as no dependencies are passed to But if this library is designed for async push like ReactiveX, then I guess it is by design anyway? |
I guess the dataflow graph can be constructed on the first run (and re-constructed on every run). Async push could be a hurdle. Is ReactiveX the same, non glitch-free? Anyway, that reminds me. Can you do experiments with |
As far as I recall, ReactiveX is full of glitches, you have to take manual actions to avoid these. Most people don't care. It is also slow when the same observable is used in many different places in the graph, e.g. if you would make a videogame and pass the current time as a signal for animation, you would get a lot of redundant callback invocations when combining multiple inputs. I'll experiment with |
Did you get a chance to mess with proxyWithComputed? |
Amazing! |
Thanks for this, so |
I just tested it, proxyWithComputed is glitch-free - https://codesandbox.io/s/proxywithcomputred-9bqfx - the callback only fires once And the derive with sync false is glitched - https://codesandbox.io/s/dervie-glitch-0ji5r |
@Noitidart Can you investigate why the test is passing? Line 304 in 2ea958b
The sync must be off by default.
|
Hey thanks I looked into it. sync is true by default now right? That's why it's passing I think. |
Isn’t sync false by default? |
Oooh I thought it changed in the new version to default to true. Yeah thats curious I'll take a look! |
Oh wow so something is broken. It's glitched in old version of v1.2.9 but in v1.2.10 it's no longer glitched, but its bugged. Here is codesandbox. After incrementing button, Here is codesandbox with v1.2.9 - https://codesandbox.io/s/dervie-glitch-0ji5r - if you increment it will change all to If you change that valtio to v1.2.10 you will see the derived values don't update. fixed test - #341 |
Thanks for looking into it! |
Thanks! :D |
First of all, thanks for sharing this very nice library!
I was doing some experiments, and I noticed that unlike most "push/pull functional reactive programming" libraries, this library is not glitch free, e.g. the callbacks of derived computations can be called with out-of-sync values, producing intermediate invalid results, and can be invoked multiple times per "leaf node" change, which can be inefficient in large "dataflow graphs".
Is this by design? To workaround this, one can apply ancient synchronous dataflow techniques, like giving each node in the dataflow a rank and using a priority queue to invoke the callbacks in the correct order. A bit like a parallel CPU stack.
Code example at https://stackblitz.com/edit/react-sqyzte
The text was updated successfully, but these errors were encountered: