diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js index 74317bf25..a92032137 100644 --- a/src/public/javascripts/services/tree.js +++ b/src/public/javascripts/services/tree.js @@ -196,7 +196,11 @@ async function resolveNotePath(notePath) { async function getRunPath(notePath) { utils.assertArguments(notePath); - notePath = notePath.split("-")[0]; + notePath = notePath.split("-")[0].trim(); + + if (notePath.length === 0) { + return; + } const path = notePath.split("/").reverse(); @@ -362,7 +366,7 @@ async function treeInitialized() { } } - const filteredTabs = []; + let filteredTabs = []; for (const openTab of openTabs) { const noteId = treeUtils.getNoteIdFromNotePath(openTab.notePath); @@ -373,6 +377,11 @@ async function treeInitialized() { } } + if (utils.isMobile()) { + // mobile frontend doesn't have tabs so show only the active tab + filteredTabs = filteredTabs.filter(tab => tab.active); + } + if (filteredTabs.length === 0) { filteredTabs.push({ notePath: 'root',