Closed tkriplean closed 7 years ago
I fixed https://considerit.us:3006/blah by passing transactions through the to_save
handlers on the server:
client('foo').to_save = (o, t) => {
// do stuff...
master.save(o, t) // Anything else saved in this passes "t" as second arg
// do stuff
t.done(o) // And when done, use t.done(o) or bus.save.fire(o, t)
}
We should pass these t
transactions through handlers as common practice. They tell statebus that the chain of reactions are all part of the same triggering event, which it knows the client has already seen.
And now for some bad news. I tried to prove to myself just now how to use transactions like this to prevent all flashbacks, and found the proof was not super simple, because there are many ways for state changes to trigger other changes to other state. But we eliminate almost all flashbacks right now... so I want to just play it empirically for now— and fix the flashbacks as they come up.
The problem with this testcase is totally different from https://consider.it:3006/blah— it's in the client instead of the server.
Furthermore, it seems to happen only once every ~2000 state changes. It's hard to reproduce, and not of much impact, so I'm just leaving it alone for now.
Mike's transaction fix above solved this problem
I get lots of flashbacks when dragging a slider, when the slider value gets saved to the server immediately on change. For example, you can see lots of annoying flashbacks when dragging at https://considerit.us:3006/blah.
I created this simple test case for figuring out the problem. Flashbacks aren't as annoying in this test case as at considerit.us, but they still occur pretty frequently.