You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've designed a custom redux middleware in a attempt to really push all side-effects away from my view code by means of redux-saga. I am basically appending a FIFO "TaskReducer" to my single redux store, and handling any QUEUE actions with it:
//queue action creatorfunctionqueue(task){return{type: 'QUEUE',payload: task};};//taskMiddlewareexportdefaultstore=>next=>action=>{constresult=next(queue(action));returnresult;}//and a TaskReducer that merges repeated tasks in a meaningful way (e.g. a FIFO queue) ...
I find this way of delegating tasks quite convenient for performance reasons. However, since the QUEUE action plays as any other action in redux, any store listeners (e.g. hundreds of connected components) will eventually waste time on it, and even DevTools won't work properly since I am not interested in replaying side-effects...
So I was wondering if this situation is of any interest for this repository, as it seems to me that this is the correct place to implement a solution for "undesired action subscriptions".
Perhaps passing the dispatched action as an argument for the batch function would solve this? That way we could easily check for the action type and decide whether we should notify the listeners or not:
I think this could be of some value, conditional notifications is a topic that has come up a few times; there is even @tshelburne package redux-skip-by-action who's code could be simplified by having something like this.
With that being said I do wonder if conditional subscriber notifications is a case of premature optimization, I could see it causing some difficult to debug situations. See reduxjs/redux#580 for a similar issue.
I dont mind adding support for this as I do believe why waste cycles if you don't need to, my only concern is it getting misused.
Hi. I've designed a custom redux middleware in a attempt to really push all side-effects away from my view code by means of redux-saga. I am basically appending a FIFO "TaskReducer" to my single redux store, and handling any QUEUE actions with it:
I find this way of delegating tasks quite convenient for performance reasons. However, since the QUEUE action plays as any other action in redux, any store listeners (e.g. hundreds of connected components) will eventually waste time on it, and even DevTools won't work properly since I am not interested in replaying side-effects...
So I was wondering if this situation is of any interest for this repository, as it seems to me that this is the correct place to implement a solution for "undesired action subscriptions".
Perhaps passing the dispatched action as an argument for the batch function would solve this? That way we could easily check for the action type and decide whether we should notify the listeners or not:
Anyways, is this worth pull requesting?
The text was updated successfully, but these errors were encountered: