| ... | @@ -29,13 +29,19 @@ type RenderablePatch = | ... | @@ -29,13 +29,19 @@ type RenderablePatch = |
| 29 | reason: string; | 29 | reason: string; |
| 30 | }; | 30 | }; |
| 31 | | 31 | |
| 32 | function getRenderablePatch(patch: string | undefined): RenderablePatch | null { | 32 | function getRenderablePatch( |
| | 33 | patch: string | undefined, |
| | 34 | cacheScope = "diff-panel", |
| | 35 | ): RenderablePatch | null { |
| 33 | if (!patch) return null; | 36 | if (!patch) return null; |
| 34 | const normalizedPatch = patch.trim(); | 37 | const normalizedPatch = patch.trim(); |
| 35 | if (normalizedPatch.length === 0) return null; | 38 | if (normalizedPatch.length === 0) return null; |
| 36 | | 39 | |
| 37 | try { | 40 | try { |
| 38 | const parsedPatches = parsePatchFiles(normalizedPatch, buildPatchCacheKey(normalizedPatch)); | 41 | const parsedPatches = parsePatchFiles( |
| | 42 | normalizedPatch, |
| | 43 | buildPatchCacheKey(normalizedPatch, cacheScope), |
| | 44 | ); |
| 39 | const files = parsedPatches.flatMap((parsedPatch) => parsedPatch.files); | 45 | const files = parsedPatches.flatMap((parsedPatch) => parsedPatch.files); |
| 40 | if (files.length > 0) { | 46 | if (files.length > 0) { |
| 41 | return { kind: "files", files }; | 47 | return { kind: "files", files }; |
| ... | @@ -190,7 +196,10 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { | ... | @@ -190,7 +196,10 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { |
| 190 | const selectedPatch = selectedTurn ? selectedTurnCheckpointDiff : conversationCheckpointDiff; | 196 | const selectedPatch = selectedTurn ? selectedTurnCheckpointDiff : conversationCheckpointDiff; |
| 191 | const hasResolvedPatch = typeof selectedPatch === "string"; | 197 | const hasResolvedPatch = typeof selectedPatch === "string"; |
| 192 | const hasNoNetChanges = hasResolvedPatch && selectedPatch.trim().length === 0; | 198 | const hasNoNetChanges = hasResolvedPatch && selectedPatch.trim().length === 0; |
| 193 | const renderablePatch = useMemo(() => getRenderablePatch(selectedPatch), [selectedPatch]); | 199 | const renderablePatch = useMemo( |
| | 200 | () => getRenderablePatch(selectedPatch, `diff-panel:${resolvedTheme}`), |
| | 201 | [resolvedTheme, selectedPatch], |
| | 202 | ); |
| 194 | const renderableFiles = useMemo(() => { | 203 | const renderableFiles = useMemo(() => { |
| 195 | if (!renderablePatch || renderablePatch.kind !== "files") { | 204 | if (!renderablePatch || renderablePatch.kind !== "files") { |
| 196 | return []; | 205 | return []; |