Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 7b76728

Browse files
authored
fix: code intel broken on diffs with newly added files (#846)
1 parent 6b890eb commit 7b76728

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/browser-extensions/src/libs/github/dom_functions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,17 @@ export const getDiffLineRanges: CodeView['getLineRanges'] = (codeView, part) =>
197197

198198
for (const row of codeView.querySelectorAll<HTMLTableRowElement>('tr')) {
199199
const isCode =
200-
!row.classList.contains('js-expandable-line') && !row.classList.contains('js-inline-comments-container')
200+
!row.classList.contains('js-expandable-line') &&
201+
!row.classList.contains('js-inline-comments-container') &&
202+
!row.querySelector('[data-line-number="..."]')
201203

202204
if (isCode) {
203205
const line = row.querySelector<HTMLElement>(
204206
`td${isDomSplitDiff() ? `:nth-of-type(${part === 'base' ? 2 : 4})` : '.blob-code'}`
205-
)!
207+
)
208+
206209
if (
210+
!line ||
207211
line.classList.contains('empty-cell') ||
208212
line.classList.contains(part === 'base' ? 'blob-code-addition' : 'blob-code-deletion')
209213
) {

0 commit comments

Comments
 (0)