Hey <@UPWE6PJCE>. We were talking about this previ...
# orbit-mvi
k
Hey @Mikolaj Leszczynski. We were talking about this previously, but I am using orbit with rx, and on the transformation, I pass the
eventObservable
and
currentState
to my transformers that I have defined outside (similar to the example). When I pass that
currentState
, I am passing its value on the cretion of the stream so it will always be the initial version of that state. In order to have the latest value of that state, the actual current state, what I did was looping back an object that had the things I needed from the state to make my request. That solves my problem, but I was thinking what other alternatives we have. One would be modifying the stream with a
map
but maybe there is a more obvious one I am missing. Thanks in advance.
m
So the
currentState
field will capture the latest state and like you rightly said, if you pass it to an external transformer this value is captured when the orbit container is instantiated. The easiest solution to this is to pass a lambda to your delegate class instead. I.e. not
transform { delegate.something(eventObservable, currentState) }
but
transform { delegate.something(eventObservable, { currentState }) }
. Then whenever you invoke that lambda in your observable you will have the current state.
k
I haven’t though about that one, thanks a lot.