Closed bradtwurst closed 2 years ago
You could write your own middleware to grab the value of every feature in the store before an action is dispatched, and after dispatch throw an exception if object.ReferenceEquals returns true on every new value.
Be aware though, some actions are meant to trigger effects without updating state. Also, StoreInitializedAction doesn't change state.
I could write the middleware to handle that for States, but what about Effects?
How could middleware be written to determine that no effects were called?
If, for example, I unintentionally typed in the incorrect action type in the Effects method definition, the only indication that something is wrong is when the effect doesn't handle the action.
Not that this situation should happen often, but if the library can basically say, "hey, you might have something wrong in your logic" during the development process, it keeps one level of my stupidness away from the code.
Is there anything exposed by Fluxor that I can use to review what effects and reducers are wired up?
You'd write integration tests for that.
Use your app's code to create your ServiceCollection, and then mock out anything that talks to anything external, then assert they were called.
I encountered a situation yesterday which was of my own making.
I had Dispatched a message that was not the same message that I was listening for in the reducer.
I spent quite of bit of time blaming a lot of other things when it was something quite simple.
It would be helpful, especially during the development process, to have the option to have the dispatcher throw an exception when there is no reducer/effect subscribing to that message.