Closed carlblanchard closed 2 years ago
Can you show me some code? I can't think where you are getting previous state from.
Line 16 of https://github.com/mrpmorris/Fluxor/blob/master/Source/Fluxor/StateSelection.cs
However, on further inspection, I am not convinced it's actually the previous state. I think it's the same as the action. I was kind of hoping there would be a stack of states (used in timewarp) when a new action was dispatched the value property would be the new state and the previousvalue property would be, well the previous state.
My use case is SingleR subscribing and unsubscribing from groups of course if someone changes their group you need to unsubscribe before subscribing hence the need for the previous value.
Can you make the notification "GroupChanged" and have old + new?
Or GroupsChanged in which there is the complete list of active ones?
Or clear all of them, and just subscribe to the new one?
Yeah, I've worked around my problem... was my thinking of the Previous value property correct? it would be good to know you can access previous data.
There is no built in way for you to get access to previous state. I expect you could do it with middleware.
Hi Mr Morris, Question for you.
At runtime, I can see the state store IState contains a Previousvalue property. (FYI I'm hooked into StateStore.StateChanged event)
I'm having difficulties in casting the state store to StateSelection in order to access the Previous value property.
Everything I am doing is feeling hacky, so was wondering if you know of an elegant way to access the previous state when a state change is detected.
Kind regards