diff --git a/comm/dispatcher.js b/comm/dispatcher.js index 297a2ed..c07db6d 100644 --- a/comm/dispatcher.js +++ b/comm/dispatcher.js @@ -34,12 +34,14 @@ export class Dispatcher { if (debugAction) { debug(`dispatching ${JSON.stringify(debugAction, null, ' ')}`); } - - Promise.resolve(actions[action.type](action)).then((result) => { + const actionPromise = actions[action.type](action); + Promise.resolve(actionPromise).then((result) => { if ('undefined' === typeof result) { debug(`undefined result from ${action.type} not forwarded!`); } - socket.write(pack(result)); + else { + socket.write(pack(result)); + } socket.end(); }).catch((error) => { this.handleError(error); }); });