mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
check for null/undefined session in addSessionData (#1698)
* check for null/undefined session in addSessionData * Update sessions.js
This commit is contained in:
parent
aa7e79a039
commit
af21493e2b
1 changed files with 16 additions and 15 deletions
|
|
@ -53,22 +53,23 @@ export function addSessionData(uid, data) {
|
|||
type: SESSION_ADD_DATA,
|
||||
data,
|
||||
effect() {
|
||||
const {shell} = getState().sessions.sessions[uid];
|
||||
const enterKey = data.indexOf('\n') > 0;
|
||||
const url = enterKey ? isUrl(shell, data) : null;
|
||||
if (url) {
|
||||
dispatch({
|
||||
type: SESSION_URL_SET,
|
||||
uid,
|
||||
url
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: SESSION_PTY_DATA,
|
||||
uid,
|
||||
data
|
||||
});
|
||||
const session = getState().sessions.sessions[uid];
|
||||
if (session) {
|
||||
const enterKey = data.indexOf('\n') > 0;
|
||||
const url = enterKey ? isUrl(session.shell, data) : null;
|
||||
if (url) {
|
||||
return dispatch({
|
||||
type: SESSION_URL_SET,
|
||||
uid,
|
||||
url
|
||||
});
|
||||
}
|
||||
}
|
||||
dispatch({
|
||||
type: SESSION_PTY_DATA,
|
||||
uid,
|
||||
data
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue