Skip to content

Commit 7b2c3af

Browse files
committed
always open the note in URL, closes #3571
1 parent 2e181d0 commit 7b2c3af

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

package-lock.json

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/app/components/tab_manager.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ export default class TabManager extends Component {
7979
filteredTabs = filteredTabs.filter(tab => tab.active);
8080
}
8181

82-
if (filteredTabs.length === 0) {
83-
const [notePath] = treeService.getHashValueFromAddress();
82+
// resolve before opened tabs can change this
83+
const [notePathInUrl, ntxIdInUrl] = treeService.getHashValueFromAddress();
8484

85+
if (filteredTabs.length === 0) {
8586
filteredTabs.push({
86-
notePath: notePath || 'root',
87+
notePath: notePathInUrl || 'root',
8788
active: true,
8889
hoistedNoteId: glob.extraHoistedNoteId || 'root'
8990
});
@@ -95,17 +96,14 @@ export default class TabManager extends Component {
9596

9697
await this.tabsUpdate.allowUpdateWithoutChange(async () => {
9798
for (const tab of filteredTabs) {
98-
9999
await this.openContextWithNote(tab.notePath, tab.active, tab.ntxId, tab.hoistedNoteId, tab.mainNtxId);
100100
}
101101
});
102102

103103
// if there's notePath in the URL, make sure it's open and active
104104
// (useful, for e.g. opening clipped notes from clipper or opening link in an extra window)
105-
if (treeService.isNotePathInAddress()) {
106-
const [notePath, ntxId] = treeService.getHashValueFromAddress();
107-
108-
await appContext.tabManager.switchToNoteContext(ntxId, notePath);
105+
if (notePathInUrl) {
106+
await appContext.tabManager.switchToNoteContext(ntxIdInUrl, notePathInUrl);
109107
}
110108
}
111109
catch (e) {

0 commit comments

Comments
 (0)