I have something like the following:
const cUpdate =
.orElse(sCommit.map(() => S.Nothing)) //This will automatically mark the update as completed
const cCommit =
.snapshot(cUpdate, commitStuff)) //if cUpdate is a Nothing, it's a noop
The idea is two different streams -
sCommit essentially commits or flushes the changes that were staged during
However, once those changes were committed, there's no reason for it to re-commit. The line:
.orElse(sCommit.map(() => S.Nothing)) is therefore intended to mark the update as flushed once it's committed.
Do I have the ordering right? Is
cUpdate guaranteed to be that
commitStuff runs? i.e. after the changes have been flushed?
I believe I can more explicitly do that via something like
const cFlushed = sCommit.map(() => S.Nothing).hold(S.Nothing) and then change
snapshot3 and get the status there... I think this might be somehow more guaranteed since holds are delayed - but I'm not sure
(edit: I tried the hold/snapshot thing and it didn't work... from casual observation, the first sample code I posted seems to be fine - but it's a bit hard to tell without unit tests if I'm missing an event)