Skip to content

Commit

Permalink
Merge pull request #174 from berzniz/only_show_on_diff_view
Browse files Browse the repository at this point in the history
Bug fix: only show tree when diff view is available
  • Loading branch information
berzniz authored Sep 8, 2021
2 parents 788187f + 2bfd33f commit 6841c21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class Top extends React.Component {
}

const renderTree = () => {
const diffViewElement = Boolean(document.querySelector('.diff-view'))
const fileCount = parseInt((document.getElementById('files_tab_counter') || { innerText: 0 }).innerText, 10)
const rootElement = createRootElement()
const enabled = Boolean(rootElement && fileCount > 0)
const enabled = Boolean(rootElement && diffViewElement && fileCount > 0)
document.body.classList.toggle('enable_better_github_pr', enabled)
if (!enabled) {
return
Expand Down

0 comments on commit 6841c21

Please sign in to comment.