fix(pull-requests): expand code tab diffs by default (#9174)

Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
mariaandmaria-rcks authored and GitHub committed 2026-09-02 01:44:25 -04:00
1 parent 80a14b6588
commit 0681d85499
2 files changed
+11 -12

No files matched your search

@@ -30,15 +30,14 @@ export type DiffFoldOverride = "expanded" | "folded" | null;
* A diff arrives a slice at a time, so the reader's own choices are kept as the difference from
* what the toolbar last said rather than as the set of folded files: a file that has not loaded
* yet cannot be in a set, and would otherwise land expanded moments after the reader folded
* everything. Folded is the starting point whatever the change's size, because laying out every
* file of it costs the reader the seconds before the tab is usable and buries the file they came
* for among the ones they did not.
* everything. Files start expanded so opening the Code tab immediately shows the change; the
* reader can still fold individual files or the whole diff from the toolbar.
*/
export function isFileDiffCollapsed(
fileKey: string,
foldOverride: DiffFoldOverride,
toggledFileKeys: ReadonlySet<string>,
): boolean {
const foldedByDefault = foldOverride !== "expanded";
const foldedByDefault = foldOverride === "folded";
return toggledFileKeys.has(fileKey) ? !foldedByDefault : foldedByDefault;
}