From 1ef4b932bd4038c67481077aa1e8408123e8df51 Mon Sep 17 00:00:00 2001 From: Jimmy Bosse Date: Fri, 18 Jan 2019 10:35:37 -0500 Subject: [PATCH] Get pid from state directly. --- linuxActionHandler.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/linuxActionHandler.js b/linuxActionHandler.js index 45cfbb7..8d361d9 100644 --- a/linuxActionHandler.js +++ b/linuxActionHandler.js @@ -3,8 +3,6 @@ const configParse = require('./configParse'); const { setCwd } = require('./setCwd'); const fixPath = require('./fixPath'); -let tabs = {}; - module.exports = ({ getState, dispatch }) => next => async (action) => { switch (action.type) { case 'CONFIG_LOAD': { @@ -24,22 +22,12 @@ module.exports = ({ getState, dispatch }) => next => async (action) => { } case 'SESSION_REQUEST': case 'TERM_GROUP_REQUEST': - const { sessions: { activeUid } } = getState(); - if (activeUid) { - await setCwd({ dispatch, action, tab: tabs[activeUid]}); + const { sessions, sessions: { activeUid } } = getState(); + const pid = sessions.sessions[activeUid].pid + if (pid) { + await setCwd({ dispatch, action, tab: {pid: pid}}); } break; - case 'SESSION_ADD': - tabs[action.uid] = { - pid: action.pid, - }; - break; - case 'SESSION_PTY_EXIT': - delete tabs[action.uid]; - break; - case 'SESSION_USER_EXIT': - delete tabs[action.uid]; - break; default: break; }