Skip to content

Commit fb0b35b

Browse files
committed
Omit unset diff query fields
- Skip undefined checkpoint diff inputs when building queries - Tighten diff panel formatting and test typing
1 parent 1d55c63 commit fb0b35b

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ const make = Effect.gen(function* () {
133133
fromCheckpointRef,
134134
toCheckpointRef,
135135
fallbackFromToHead: false,
136-
relativePath: input.relativePath,
137-
contextMode: input.contextMode,
136+
...(input.relativePath ? { relativePath: input.relativePath } : {}),
137+
...(input.contextMode ? { contextMode: input.contextMode } : {}),
138138
});
139139

140140
const turnDiff: OrchestrationGetTurnDiffResultType = {

apps/web/src/components/DiffPanel.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ function DiffFileSection(props: {
236236
[contextMode, filePath, fullContextDiffQuery.data?.diff, resolvedTheme],
237237
);
238238
const resolvedFileDiff =
239-
contextMode === "full" ? (resolveRenderableFileDiff(fullContextPatch, filePath) ?? fileDiff) : fileDiff;
239+
contextMode === "full"
240+
? (resolveRenderableFileDiff(fullContextPatch, filePath) ?? fileDiff)
241+
: fileDiff;
240242
const fullContextError =
241243
contextMode === "full" && fullContextDiffQuery.error
242244
? fullContextDiffQuery.error instanceof Error
@@ -768,7 +770,9 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
768770
threadId: activeThreadId,
769771
fromTurnCount: activeCheckpointRange?.fromTurnCount ?? null,
770772
toTurnCount: activeCheckpointRange?.toTurnCount ?? null,
771-
cacheScope: selectedTurn ? `turn:${selectedTurn.turnId}` : conversationCacheScope,
773+
cacheScope: selectedTurn
774+
? `turn:${selectedTurn.turnId}`
775+
: conversationCacheScope,
772776
enabled: isGitRepo,
773777
}}
774778
collapsed={fileReviewState.collapsed}

apps/web/src/lib/diffFileReviewState.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ describe("expandDiffFile", () => {
9494

9595
it("returns the same object when the file is already expanded", () => {
9696
const state = {
97-
"src/a.ts": { accepted: false, collapsed: false, contextMode: "patch" },
98-
};
97+
"src/a.ts": { accepted: false, collapsed: false, contextMode: "patch" as const },
98+
} satisfies Record<string, { accepted: boolean; collapsed: boolean; contextMode: "patch" }>;
9999
// File is already expanded, so the same object reference is returned.
100100
expect(expandDiffFile(state, "src/a.ts")).toBe(state);
101101
});

0 commit comments

Comments
 (0)