From 97ebe33d688c7f59b5099f4a8feeaf275b24a85c Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 28 Feb 2022 18:15:13 +0000 Subject: [PATCH] Dont show 1st tab if hidden when loading fixes #3455 --- .../@node-red/editor-client/src/js/red.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/red.js b/packages/node_modules/@node-red/editor-client/src/js/red.js index 2b1c8f2e4..afcdbdb1a 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/red.js +++ b/packages/node_modules/@node-red/editor-client/src/js/red.js @@ -252,8 +252,21 @@ var RED = (function() { if (/^#flow\/.+$/.test(currentHash)) { RED.workspaces.show(currentHash.substring(6),true); } - if (RED.workspaces.active() === 0 && RED.workspaces.count() > 0) { - RED.workspaces.show(RED.nodes.getWorkspaceOrder()[0]) + if (RED.workspaces.count() > 0) { + const hiddenTabs = JSON.parse(RED.settings.getLocal("hiddenTabs")||"{}"); + const workspaces = RED.nodes.getWorkspaceOrder(); + if (RED.workspaces.active() === 0) { + for (let index = 0; index < workspaces.length; index++) { + const ws = workspaces[index]; + if (!hiddenTabs[ws]) { + RED.workspaces.show(ws); + break; + } + } + } + if (RED.workspaces.active() === 0) { + RED.workspaces.show(workspaces[0]); + } } } catch(err) { console.warn(err);