Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f085e85

Browse files
committed
Also hide the React view's per-file wrapper div
In the /changes React view each diff sits in a classless wrapper that owns its spacing, so hiding only the id element left blank regions. Hide the diff's direct parent too, scoped under #diff-content-parent with a direct-child combinator so multi-file containers can't match.
1 parent a571e59 commit f085e85

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

source/features/coder-pr-loc-stats.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ function updateHiddenFilesStyle(style: HTMLStyleElement, stats: Map<CoderFileCat
7777
// `hiddenCategories` persists across PRs, so it may name categories absent from this PR
7878
const hiddenIds = [...hiddenCategories].flatMap(category => stats.get(category)?.diffIds ?? []);
7979
// Directory tree rows are ancestor `li`s of file rows, so match only the
80-
// innermost `li` or hiding one file would hide its whole directory
80+
// innermost `li` or hiding one file would hide its whole directory.
81+
// In the React view each file sits in a classless wrapper div that owns its
82+
// spacing, so also hide the diff's direct parent (never a multi-file
83+
// container because of the direct-child combinator).
8184
style.textContent = hiddenIds.length === 0
8285
? ''
8386
: hiddenIds
84-
.flatMap(id => [`#${id}`, `li:not(:has(li)):has(a[href="#${id}"])`])
87+
.flatMap(id => [
88+
`#${id}`,
89+
`#diff-content-parent div:has(> #${id})`,
90+
`li:not(:has(li)):has(a[href="#${id}"])`,
91+
])
8592
.join(',\n') + '{display: none !important;}';
8693
}
8794

0 commit comments

Comments
 (0)