Fix race condition with NICK and QUIT when multiple dispatch users are in the same channel
This commit is contained in:
parent
3393b1b706
commit
18651c1a10
8 changed files with 145 additions and 138 deletions
|
@ -1,14 +1,14 @@
|
|||
export default function createCommandMiddleware(type, handlers) {
|
||||
return store => next => action => {
|
||||
return ({ dispatch, getState }) => next => action => {
|
||||
if (action.type === type) {
|
||||
const words = action.command.slice(1).split(' ');
|
||||
const command = words[0];
|
||||
const params = words.slice(1);
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(handlers, command)) {
|
||||
if (command in handlers) {
|
||||
handlers[command]({
|
||||
dispatch: store.dispatch,
|
||||
getState: store.getState,
|
||||
dispatch,
|
||||
getState,
|
||||
server: action.server,
|
||||
channel: action.channel
|
||||
}, ...params);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue