Skip to content

Commit 6f2de3e

Browse files
committed
fix
1 parent 3cbcd95 commit 6f2de3e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

web_src/js/features/repo-view-file-tree-sidebar.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ export function initViewFileTreeSidebar() {
8484
}});
8585
fileTreeView.mount(fileTree);
8686

87-
window.addEventListener('popstate', () => {
88-
selectedItem.value = getSelectedPath(refString);
89-
loadContent(el);
90-
});
87+
if (!window.popstateListenerForViewFilePageAdded) {
88+
window.addEventListener('popstate', () => {
89+
selectedItem.value = getSelectedPath(refString);
90+
loadContent(el);
91+
});
92+
window.popstateListenerForViewFilePageAdded = true;
93+
}
9194
});
9295
}
9396

web_src/js/globals.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ interface Window {
7474
turnstile: any,
7575
hcaptcha: any,
7676
codeEditors: any[],
77+
popstateListenerForViewFilePageAdded: boolean,
7778
updateCloneStates: () => void,
7879
}

0 commit comments

Comments
 (0)