From 1163173ade3ead5485bbe851a7e46c3d231cf7f2 Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Wed, 4 Mar 2020 18:37:52 +0530 Subject: [PATCH] filter out undefined keys from createSession extraOptions --- app/ui/window.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/ui/window.ts b/app/ui/window.ts index 9cb35b90..672c092b 100644 --- a/app/ui/window.ts +++ b/app/ui/window.ts @@ -112,6 +112,10 @@ export function newWindow( function createSession(extraOptions: any = {}) { const uid = uuidv4(); + const extraOptionsFiltered: any = {}; + Object.keys(extraOptions).forEach(key => { + if (extraOptions[key] !== undefined) extraOptionsFiltered[key] = extraOptions[key]; + }); // remove the rows and cols, the wrong value of them will break layout when init create const defaultOptions = Object.assign( @@ -121,7 +125,7 @@ export function newWindow( shell: cfg.shell, shellArgs: cfg.shellArgs && Array.from(cfg.shellArgs) }, - extraOptions, + extraOptionsFiltered, {uid} ); const options = decorateSessionOptions(defaultOptions);