Skip to content

Commit 3e1593a

Browse files
committed
only query once
1 parent eda0b30 commit 3e1593a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web_src/js/components/ViewFileTreeStore.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export function createViewFileTreeStore(props: {repoLink: string, treePath: stri
3030
const response = await GET(u.href);
3131
const elViewContent = document.querySelector('.repo-view-content');
3232
elViewContent.innerHTML = await response.text();
33-
const t1 = elViewContent.querySelector('.repo-view-content-data').getAttribute('data-document-title');
34-
const t2 = elViewContent.querySelector('.repo-view-content-data').getAttribute('data-document-title-common');
33+
const elViewContentData = elViewContent.querySelector('.repo-view-content-data');
34+
const t1 = elViewContentData.getAttribute('data-document-title');
35+
const t2 = elViewContentData.getAttribute('data-document-title-common');
3536
document.title = `${t1} - ${t2}`; // follow the format in head.tmpl: <head><title>...</title></head>
3637
},
3738

0 commit comments

Comments
 (0)