> > If you call this dispatch function, it will send the action to the start of the middleware pipeline. > Which seem to describe exactly what our MiddlewareContext::dispatch does `MiddlewareContext::dispatch` will send it to the reducer chain that is constructed in `ReducerChainBuilder`. This is not the same start of the pipeline as calling `Store::dispatch`. This distinction is what I think we may be able to remove by simplifying. I also don't think it was the intent of the JS Redux docs to imply the two would be treated separately, based on other parts of the same statement you referenced: > These are the same dispatch and getState functions that are actually part of the store. If you call this dispatch function, it will send the action to the start of the middleware pipeline. Specifically, `MiddlewareContext::dispatch` is NOT the same dispatch funcion that is part of the store in our case. That said, I am not a JS Redux expert. Perhaps :boek can weigh in here as I believe he has more experience with it. > Seems like a very nice feature and I don't see any reason to remove it. What about it seems nice? Are there specific use cases that exist that you're aware of that need to be able to dispatch differently? Are there specific use cases you're envisioning? How do you feel about a name change like `dispatchImmediate`, at least for clarity? I am just trying to understand why we would want to treat dispatches from middleware differently than dispatches from anywhere else in the code.
Bug 1929079 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
> > If you call this dispatch function, it will send the action to the start of the middleware pipeline. > Which seem to describe exactly what our MiddlewareContext::dispatch does `MiddlewareContext::dispatch` will send it to the reducer chain that is constructed in `ReducerChainBuilder`. This is not the same start of the pipeline as calling `Store::dispatch`. This distinction is what I think we may be able to remove by simplifying. I also don't think it was the intent of the JS Redux docs to imply the two would be treated separately, based on other parts of the same statement you referenced: > These are the same dispatch and getState functions that are actually part of the store. If you call this dispatch function, it will send the action to the start of the middleware pipeline. Specifically, `MiddlewareContext::dispatch` is not the same dispatch function that is part of the store in our case. That said, I am not a JS Redux expert. Perhaps :boek can weigh in here as I believe he has more experience with it. > Seems like a very nice feature and I don't see any reason to remove it. What about it seems nice? Are there specific use cases that exist that you're aware of that need to be able to dispatch differently? Are there specific use cases you're envisioning? How do you feel about a name change like `dispatchImmediate`, at least for clarity? I am just trying to understand why we would want to treat dispatches from middleware differently than dispatches from anywhere else in the code.
> > If you call this dispatch function, it will send the action to the start of the middleware pipeline. > Which seem to describe exactly what our MiddlewareContext::dispatch does `MiddlewareContext::dispatch` will send it to the reducer chain that is constructed in `ReducerChainBuilder`. This is not the same start of the pipeline as calling `Store::dispatch`. I also think that in our case that the "start of the pipeline" does not need to imply "skips the line waiting at the start of the pipeline". I am only hoping to see if we can simplifying this dinction. I also don't think it was the intent of the JS Redux docs to imply the two would be treated separately, based on other parts of the same statement you referenced: > These are the same dispatch and getState functions that are actually part of the store. If you call this dispatch function, it will send the action to the start of the middleware pipeline. Specifically, `MiddlewareContext::dispatch` is not the same dispatch function that is part of the store in our case. That said, I am not a JS Redux expert. Perhaps :boek can weigh in here as I believe he has more experience with it. > Seems like a very nice feature and I don't see any reason to remove it. What about it seems nice? Are there specific use cases that exist that you're aware of that need to be able to dispatch differently? Are there specific use cases you're envisioning? How do you feel about a name change like `dispatchImmediate`, at least for clarity? I am just trying to understand why we would want to treat dispatches from middleware differently than dispatches from anywhere else in the code.