@devries-cameron20 / t3code-1 / commits / 1f698f01d9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix: PR diffs fold Viewed files the way GitHub does, on web and mobile (#37605)

Co-authored-by: Orin <orin@orin.ws> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Arif Ali committed Nov 16, 2026 at 04:13 UTC 1f698f01d9fbbc5858963c1fe81d4b3e00783a5d
11 files changed +187 -94
apps/mobile/src/features/diffs/nativeReviewDiffSurface.test.tsx
+1
@@ -219,6 +219,7 @@ function setup(integrated = false) {
219 const onDebug: NonNullable<NativeReviewDiffViewProps["onDebug"]> = (event) =>
220 handlePullRequestDiffDebugEvent(event, {
221 rowCount: data.rows.length,
222 + lastShownRowIndex: data.rows.length - 1,
223 targetFileId,
224 focusIndex: -1,
225 isIos: true,
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+35 -17
@@ -1,3 +1,8 @@
1 +import {
2 + isFileDiffCollapsed,
3 + withFileDiffFold,
4 + type FileDiffFoldChoices,
5 +} from "@t3tools/client-runtime/pull-request-diff-fold";
6 import {
7 parsePullRequestAnchor,
8 pullRequestAnchorMatchesUrl,
@@ -130,8 +135,6 @@ import {
135 sourceControlClients,
136 } from "@t3tools/client-runtime/source-control-clients";
137
133 -const EMPTY_IDS: readonly string[] = [];
134 -
138 function usePullRequestActivityRows(params: PullRequestParams, filter: ActivityFilter) {
139 const navigation = useNavigation();
140 const result = useEnvironmentQuery(composerPullRequests.activity(requestTarget(params)));
@@ -1088,7 +1091,26 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1091 const focusIndex = focusedRows.length
1092 ? data.rows.findIndex((row) => row.id === focusedRows[0]?.id)
1093 : -1;
1091 - const [collapsedIds, setCollapsedIds] = useState<readonly string[]>(EMPTY_IDS);
1094 + const [foldChoices, setFoldChoices] = useState<FileDiffFoldChoices>(() => new Map());
1095 + const [foldScope, setFoldScope] = useState(`${scopeKey}:${commit ?? "all"}`);
1096 + const [revealedFileId, setRevealedFileId] = useState<string | null>(null);
1097 + if (foldScope !== `${scopeKey}:${commit ?? "all"}`) {
1098 + setFoldScope(`${scopeKey}:${commit ?? "all"}`);
1099 + setFoldChoices(new Map());
1100 + setRevealedFileId(null);
1101 + }
1102 + const requestedFileId =
1103 + (jumpPath ? data.files.find((file) => file.path === jumpPath)?.id : null) ?? null;
1104 + // A linked file must stay open if its Viewed response arrives after the first native draw.
1105 + if (requestedFileId !== revealedFileId) {
1106 + setRevealedFileId(requestedFileId);
1107 + if (requestedFileId)
1108 + setFoldChoices((current) => withFileDiffFold(current, requestedFileId, false));
1109 + }
1110 + const viewedIdSet = new Set(viewedIds);
1111 + const collapsedIds = data.files
1112 + .filter((file) => isFileDiffCollapsed(file.id, null, foldChoices, viewedIdSet.has(file.id)))
1113 + .map((file) => file.id);
1114 const [visibleFileId, setVisibleFileId] = useState<string | null>(null);
1115 const nativeView = useRef<NativeReviewDiffViewHandle>(null);
1116 // The filter the current jump was made under. Hiding or showing test files replaces the rows,
@@ -1114,7 +1136,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1136 jumpedUnder.current = null;
1137 const file = data.files.find((entry) => entry.path === path);
1138 if (!file) return;
1117 - setCollapsedIds((ids) => ids.filter((id) => id !== file.id));
1139 + setFoldChoices((current) => withFileDiffFold(current, file.id, false));
1140 scrollToFile(file.id);
1141 });
1142 // Subscribed for the whole screen, so a pick made while the diff is still loading is kept for
@@ -1138,9 +1160,14 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1160 useEffect(() => {
1161 if (!targetFile) loadMore();
1162 }, [targetFile, loadMore]);
1163 + const lastFileRowIndex = data.rows.findLastIndex((row) => row.kind === "file");
1164 + const lastFileId = data.rows[lastFileRowIndex]?.fileId;
1165 + const lastShownRowIndex =
1166 + lastFileId && collapsedIds.includes(lastFileId) ? lastFileRowIndex : data.rows.length - 1;
1167 const onDebug: NonNullable<NativeReviewDiffViewProps["onDebug"]> = (event) =>
1168 handlePullRequestDiffDebugEvent(event, {
1169 rowCount: data.rows.length,
1170 + lastShownRowIndex,
1171 targetFileId: targetFile?.id,
1172 focusIndex,
1173 isIos: Platform.OS === "ios",
@@ -1155,8 +1182,8 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1182 const onToggleFile: NonNullable<NativeReviewDiffViewProps["onToggleFile"]> = (event) => {
1183 const id = event.nativeEvent.fileId;
1184 if (!id) return;
1158 - setCollapsedIds((ids) =>
1159 - ids.includes(id) ? ids.filter((value) => value !== id) : [...ids, id],
1185 + setFoldChoices((current) =>
1186 + withFileDiffFold(current, id, !isFileDiffCollapsed(id, null, current, viewedIdSet.has(id))),
1187 );
1188 };
1189 const visibleFile = data.files.find((file) => file.id === visibleFileId) ?? targetFile;
@@ -1270,7 +1297,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1297 setDiffHead({ scopeKey, sha: detail.data?.headSha ?? null });
1298 jumpedUnder.current = null;
1299 setSelectedRowId(null);
1273 - setCollapsedIds(EMPTY_IDS);
1300 + setFoldChoices(new Map());
1301 }}
1302 />
1303 </View>
@@ -1311,16 +1338,7 @@ function PullRequestFileRouteContent({ route }: PullRequestFileRouteProps) {
1338 onToggleViewedFile={(event) => {
1339 const file = data.files.find((file) => file.id === event.nativeEvent.fileId);
1340 if (!file || (!commit && !viewed.canToggle)) return;
1314 - const wasViewed = commit
1315 - ? commitViewedPaths.has(file.path)
1316 - : viewed.isViewed(file.path);
1317 - setCollapsedIds((ids) =>
1318 - wasViewed
1319 - ? ids.filter((id) => id !== file.id)
1320 - : ids.includes(file.id)
1321 - ? ids
1322 - : [...ids, file.id],
1323 - );
1341 + setFoldChoices((current) => withFileDiffFold(current, file.id, undefined));
1342 if (commit)
1343 setCommitViewedPaths((current) => {
1344 const next = new Set(current);
apps/mobile/src/features/pull-requests/pullRequestDiffDebug.test.ts
+6
@@ -42,9 +42,11 @@ it.each([true, false])(
42 lastRowIndex: nativeEvent.lastRowIndex as number,
43 });
44 };
45 + let lastShownRowIndex = 999;
46 const emit = (nativeEvent: Record<string, unknown>) =>
47 handlePullRequestDiffDebugEvent({ nativeEvent } as Parameters<typeof onDebug>[0], {
48 rowCount: 1000,
49 + lastShownRowIndex,
50 targetFileId: "last-file",
51 focusIndex: -1,
52 isIos,
@@ -74,6 +76,10 @@ it.each([true, false])(
76 expect(loadMore).not.toHaveBeenCalled();
77 emit({ message: "visible-range", firstRowIndex: 950, lastRowIndex: 990, totalRows: 1000 });
78 expect(loadMore).toHaveBeenCalledOnce();
79 + // A folded final file ends at its header, short of the full payload's tail.
80 + lastShownRowIndex = 920;
81 + emit({ message: "visible-range", firstRowIndex: 880, lastRowIndex: 920, totalRows: 1000 });
82 + expect(loadMore).toHaveBeenCalledTimes(2);
83 } finally {
84 scheduler.cancel();
85 vi.useRealTimers();
apps/mobile/src/features/pull-requests/pullRequestDiffDebug.ts
+7 -1
@@ -21,6 +21,8 @@ export function handlePullRequestDiffDebugEvent(
21 event: Parameters<NonNullable<NativeReviewDiffViewProps["onDebug"]>>[0],
22 input: {
23 readonly rowCount: number;
24 + /** The last row native can draw: a folded final file ends at its header. */
25 + readonly lastShownRowIndex: number;
26 readonly targetFileId: string | undefined;
27 readonly focusIndex: number;
28 readonly isIos: boolean;
@@ -60,5 +62,9 @@ export function handlePullRequestDiffDebugEvent(
62 }
63 if (!drawn) return;
64 const lastRow = event.nativeEvent.lastRowIndex;
63 - if (typeof lastRow === "number" && lastRow >= input.rowCount - 40) input.loadMore();
65 + if (
66 + typeof lastRow === "number" &&
67 + lastRow >= Math.min(input.rowCount - 40, input.lastShownRowIndex)
68 + )
69 + input.loadMore();
70 }
apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx
+53 -1
@@ -8,6 +8,7 @@ import {
8 type PullRequestDiffResult,
9 } from "@t3tools/contracts";
10 import { expect, it, vi } from "vite-plus/test";
11 +import { userEvent } from "vite-plus/test/browser";
12
13 import "~/index.css";
14 import { __setClientSettingsForTests } from "../../hooks/useSettings";
@@ -85,7 +86,12 @@ vi.mock(import("./usePullRequestFilesViewed"), async () => {
86 enabled: viewedPaths !== null,
87 isViewed: (path: string) => viewedPaths?.has(path) === true,
88 isStale: () => false,
88 - setViewed: () => {},
89 + setViewed: (path: string, viewed: boolean) => {
90 + const next = new Set(mocks.viewedPaths);
91 + if (viewed) next.add(path);
92 + else next.delete(path);
93 + deliverViewedPaths(next);
94 + },
95 truncated: false,
96 error: null,
97 refresh: () => {},
@@ -207,6 +213,52 @@ it("keeps the diff after a refresh that brings back the same page", async () =>
213 await expect.element(screen.getByText("1 file", { exact: true })).toBeVisible();
214 });
215
216 +it("restores saved Viewed folds, follows cleared marks, and allows explicit expansion", async () => {
217 + setup({ paged: false });
218 + __setClientSettingsForTests({ ...DEFAULT_CLIENT_SETTINGS, diffFilesCollapsed: false });
219 + using _preferences = {
220 + [Symbol.dispose]() {
221 + __setClientSettingsForTests(DEFAULT_CLIENT_SETTINGS);
222 + },
223 + };
224 + mocks.viewedPaths = new Set(["a.ts"]);
225 + const container = document.createElement("div");
226 + container.className = "flex h-[700px] w-[900px]";
227 + await using screen = await render(tab(0), { container });
228 + await expect.element(screen.getByRole("checkbox", { name: "Viewed" })).toBeChecked();
229 + await expect
230 + .element(screen.getByRole("button", { name: "Expand diff", exact: true }))
231 + .toHaveAttribute("aria-expanded", "false");
232 +
233 + await screen.getByRole("button", { name: "Expand diff", exact: true }).click();
234 + await expect.element(screen.getByText("three()", { exact: true })).toBeVisible();
235 + screen.getByRole("checkbox", { name: "Viewed" }).element().focus();
236 + await userEvent.keyboard(" ");
237 + await expect.element(screen.getByRole("checkbox", { name: "Viewed" })).not.toBeChecked();
238 + await expect.element(screen.getByText("three()", { exact: true })).toBeVisible();
239 + screen.getByRole("checkbox", { name: "Viewed" }).element().focus();
240 + await userEvent.keyboard(" ");
241 + await expect
242 + .element(screen.getByRole("button", { name: "Expand diff", exact: true }))
243 + .toHaveAttribute("aria-expanded", "false");
244 +
245 + deliverViewedPaths(new Set());
246 + await expect.element(screen.getByRole("checkbox", { name: "Viewed" })).not.toBeChecked();
247 + await expect.element(screen.getByText("three()", { exact: true })).toBeVisible();
248 + deliverViewedPaths(new Set(["a.ts"]));
249 + await expect
250 + .element(screen.getByRole("button", { name: "Expand diff", exact: true }))
251 + .toHaveAttribute("aria-expanded", "false");
252 + await screen.getByRole("button", { name: "Expand all files", exact: true }).click();
253 + await expect.element(screen.getByText("three()", { exact: true })).toBeVisible();
254 +
255 + await screen.rerender(<div />);
256 + await screen.rerender(tab(1));
257 + await expect
258 + .element(screen.getByRole("button", { name: "Expand diff", exact: true }))
259 + .toHaveAttribute("aria-expanded", "false");
260 +});
261 +
262 // regression: #13279 a Viewed answer that lands after a link reveals a file must not fold it
263 it("keeps a revealed file open when its Viewed mark loads afterwards", async () => {
264 setup({ paged: false });
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
+14 -13
@@ -1,3 +1,9 @@
1 +import {
2 + isFileDiffCollapsed,
3 + withFileDiffFold,
4 + type DiffFoldOverride,
5 + type FileDiffFoldChoices,
6 +} from "@t3tools/client-runtime/pull-request-diff-fold";
7 import {
8 parsePullRequestAnchor,
9 pullRequestDiffPathMatches,
@@ -132,14 +138,7 @@ import {
138 toViewerSide,
139 } from "./PullRequestReviewAnnotation";
140 import { pullRequestCompletionScope } from "./PullRequestMarkdownTextarea";
135 -import {
136 - getFileViewedRange,
137 - isFileDiffCollapsed,
138 - isLineInFileDiff,
139 - withFileDiffFold,
140 - type DiffFoldOverride,
141 - type FileDiffFoldChoices,
142 -} from "./pullRequestDiff.logic";
141 +import { getFileViewedRange, isLineInFileDiff } from "./pullRequestDiff.logic";
142 import { PullRequestDiffStat, PullRequestMetaLine } from "./pullRequestPresentation";
143 import { PullRequestDiffUnavailableState } from "./PullRequestDiffUnavailableState";
144 import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed";
@@ -439,8 +438,7 @@ function PullRequestCodeTab({
438 const [lastViewedFileKey, setLastViewedFileKey] = useState<string | null>(null);
439 const [visibleCommitCount, setVisibleCommitCount] = useState(COMMIT_PAGE_SIZE);
440 const [foldOverride, setFoldOverride] = useState<DiffFoldOverride>(null);
442 - const effectiveFoldOverride =
443 - foldOverride ?? (settings.diffFilesCollapsed ? "folded" : "expanded");
441 + const effectiveFoldOverride = foldOverride ?? (settings.diffFilesCollapsed ? "folded" : null);
442 const diffLayout = settings.diffLayout;
443 const [wordWrapOverride, setWordWrapOverride] = useState<boolean | null>(null);
444 const wordWrap = wordWrapOverride ?? settings.wordWrap;
@@ -932,9 +930,8 @@ function PullRequestCodeTab({
930 </div>
931 );
932
935 - // A stale mark means the file changed since it was viewed; Fold all and Expand all outrank marks.
933 const foldsAsViewed = (path: string) =>
937 - foldOverride === null && filesViewedEnabled && isFileViewed(path) && !isFileViewedStale(path);
934 + filesViewedEnabled && isFileViewed(path) && !isFileViewedStale(path);
935 const items: CodeViewDiffItem<ReviewAnnotationGroup>[] = annotatedFiles.map(
936 ({ fileKey, path, fileDiff, annotations, annotationsVersion }) => {
937 const collapsed = isFileDiffCollapsed(
@@ -1007,7 +1004,11 @@ function PullRequestCodeTab({
1004 setViewed(file.path, viewed, commit === null ? file.fileDiff.newObjectId : undefined);
1005 }
1006 setFoldChoices((current) =>
1010 - range.reduce((next, file) => withFileDiffFold(next, file.fileKey, viewed), current),
1007 + range.reduce(
1008 + (next, file) =>
1009 + withFileDiffFold(next, file.fileKey, effectiveFoldOverride === null ? undefined : viewed),
1010 + current,
1011 + ),
1012 );
1013 };
1014 const fileViewedToggle = {
apps/web/src/components/pullRequest/pullRequestDiff.logic.test.ts
+1 -35
@@ -1,12 +1,7 @@
1 import type { FileDiffMetadata } from "@pierre/diffs";
2 import { describe, expect, it } from "vite-plus/test";
3
4 -import {
5 - getFileViewedRange,
6 - isFileDiffCollapsed,
7 - isLineInFileDiff,
8 - withFileDiffFold,
9 -} from "./pullRequestDiff.logic";
4 +import { getFileViewedRange, isLineInFileDiff } from "./pullRequestDiff.logic";
5
6 function fileWithHunks(
7 hunks: ReadonlyArray<{
@@ -40,35 +35,6 @@ describe("isLineInFileDiff", () => {
35 });
36 });
37
43 -describe("isFileDiffCollapsed", () => {
44 - // regression: #9174 diffs now expand by default; a reader's fold must survive new slices
45 - it("keeps a file the reader folded closed as the next slice arrives", () => {
46 - const choices = new Map([["b.ts", true]]);
47 - expect(isFileDiffCollapsed("b.ts", "expanded", choices)).toBe(true);
48 - expect(isFileDiffCollapsed("c.ts", "expanded", choices)).toBe(false);
49 - });
50 -
51 - it("folds a file marked Viewed when the Code tab mounts again with no fold choices", () => {
52 - expect(isFileDiffCollapsed("a.ts", "expanded", new Map(), true)).toBe(true);
53 - expect(isFileDiffCollapsed("a.ts", "expanded", new Map(), false)).toBe(false);
54 - });
55 -
56 - it("keeps a reader's choice when the file's Viewed mark loads later", () => {
57 - const choices = new Map([["a.ts", false]]);
58 - expect(isFileDiffCollapsed("a.ts", "expanded", choices, false)).toBe(false);
59 - expect(isFileDiffCollapsed("a.ts", "expanded", choices, true)).toBe(false);
60 - });
61 -});
62 -
63 -describe("withFileDiffFold", () => {
64 - it("records an absolute choice and keeps the same map when nothing changes", () => {
65 - const folded = withFileDiffFold(new Map(), "a.ts", true);
66 - expect(folded.get("a.ts")).toBe(true);
67 - expect(withFileDiffFold(folded, "a.ts", true)).toBe(folded);
68 - expect(withFileDiffFold(folded, "a.ts", false).get("a.ts")).toBe(false);
69 - });
70 -});
71 -
38 describe("getFileViewedRange", () => {
39 const files = ["c.ts", "a.ts", "b.ts", "d.ts"].map((fileKey) => ({ fileKey }));
40
apps/web/src/components/pullRequest/pullRequestDiff.logic.ts
-27
@@ -14,33 +14,6 @@ export function isLineInFileDiff(
14 );
15 }
16
17 -export type DiffFoldOverride = "expanded" | "folded" | null;
18 -
19 -/** The reader's own fold choice per file. It is absolute, so a Viewed mark loading later keeps it. */
20 -export type FileDiffFoldChoices = ReadonlyMap<string, boolean>;
21 -
22 -/**
23 - * A reader's own choice wins. Otherwise the toolbar decides, and a file still marked Viewed
24 - * starts folded. Fold all and Expand all clear the choices, so later pages follow the toolbar.
25 - */
26 -export function isFileDiffCollapsed(
27 - fileKey: string,
28 - foldOverride: DiffFoldOverride,
29 - choices: FileDiffFoldChoices,
30 - viewed = false,
31 -): boolean {
32 - return choices.get(fileKey) ?? (foldOverride === "folded" || viewed);
33 -}
34 -
35 -export function withFileDiffFold(
36 - choices: FileDiffFoldChoices,
37 - fileKey: string,
38 - collapsed: boolean,
39 -): FileDiffFoldChoices {
40 - if (choices.get(fileKey) === collapsed) return choices;
41 - return new Map(choices).set(fileKey, collapsed);
42 -}
43 -
17 export function getFileViewedRange<T extends { readonly fileKey: string }>(
18 files: ReadonlyArray<T>,
19 fileKey: string,
packages/client-runtime/package.json
+4
@@ -3,6 +3,10 @@
3 "private": true,
4 "type": "module",
5 "exports": {
6 + "./pull-request-diff-fold": {
7 + "types": "./src/pullRequestDiffFold.ts",
8 + "default": "./src/pullRequestDiffFold.ts"
9 + },
10 "./assembly-highlighting": {
11 "types": "./src/assemblyHighlighting.ts",
12 "default": "./src/assemblyHighlighting.ts"
packages/client-runtime/src/pullRequestDiffFold.test.ts new
+41
@@ -0,0 +1,41 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { isFileDiffCollapsed, withFileDiffFold } from "./pullRequestDiffFold.ts";
4 +
5 +describe("isFileDiffCollapsed", () => {
6 + it("collapses saved viewed files on reopening and when a later read marks them viewed", () => {
7 + const overrides = new Map<string, boolean>();
8 + expect(isFileDiffCollapsed("a.ts", null, overrides, false)).toBe(false);
9 + expect(isFileDiffCollapsed("a.ts", null, overrides, true)).toBe(true);
10 + expect(isFileDiffCollapsed("a.ts", null, overrides, false)).toBe(false);
11 + });
12 +
13 + it("preserves individual choices while viewed state and loaded pages change", () => {
14 + const overrides = new Map([
15 + ["a.ts", false],
16 + ["b.ts", true],
17 + ]);
18 + expect(isFileDiffCollapsed("a.ts", null, overrides, true)).toBe(false);
19 + expect(isFileDiffCollapsed("b.ts", null, overrides, false)).toBe(true);
20 + expect(isFileDiffCollapsed("c.ts", null, overrides, true)).toBe(true);
21 + expect(isFileDiffCollapsed("d.ts", null, overrides, false)).toBe(false);
22 + });
23 +
24 + it("respects expand all and fold all, including later pages and individual exceptions", () => {
25 + const overrides = new Map<string, boolean>();
26 + expect(isFileDiffCollapsed("a.ts", "expanded", overrides, true)).toBe(false);
27 + expect(isFileDiffCollapsed("b.ts", "folded", overrides, false)).toBe(true);
28 + expect(isFileDiffCollapsed("c.ts", "folded", new Map([["c.ts", false]]), true)).toBe(false);
29 + expect(isFileDiffCollapsed("d.ts", "expanded", new Map([["d.ts", true]]), false)).toBe(true);
30 + });
31 +});
32 +
33 +describe("withFileDiffFold", () => {
34 + it("records or clears a choice and keeps the same map when nothing changes", () => {
35 + const folded = withFileDiffFold(new Map(), "a.ts", true);
36 + expect(folded.get("a.ts")).toBe(true);
37 + expect(withFileDiffFold(folded, "a.ts", true)).toBe(folded);
38 + expect(withFileDiffFold(folded, "a.ts", false).get("a.ts")).toBe(false);
39 + expect(withFileDiffFold(folded, "a.ts", undefined).has("a.ts")).toBe(false);
40 + });
41 +});
packages/client-runtime/src/pullRequestDiffFold.ts new
+25
@@ -0,0 +1,25 @@
1 +export type DiffFoldOverride = "expanded" | "folded" | null;
2 +
3 +/** The reader's own fold choice per file. It is absolute, so a Viewed mark loading later keeps it. */
4 +export type FileDiffFoldChoices = ReadonlyMap<string, boolean>;
5 +
6 +export function isFileDiffCollapsed(
7 + fileKey: string,
8 + foldOverride: DiffFoldOverride,
9 + choices: FileDiffFoldChoices,
10 + viewed = false,
11 +): boolean {
12 + return choices.get(fileKey) ?? (foldOverride === null ? viewed : foldOverride === "folded");
13 +}
14 +
15 +export function withFileDiffFold(
16 + choices: FileDiffFoldChoices,
17 + fileKey: string,
18 + collapsed: boolean | undefined,
19 +): FileDiffFoldChoices {
20 + if (choices.get(fileKey) === collapsed) return choices;
21 + const next = new Map(choices);
22 + if (collapsed === undefined) next.delete(fileKey);
23 + else next.set(fileKey, collapsed);
24 + return next;
25 +}