Skip to content

Commit 8ffef06

Browse files
danielroetaskylizard
authored andcommitted
chore: cleanup
1 parent cfd7f2f commit 8ffef06

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

app/components/diff/ViewerPanel.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
import type { FileDiffResponse, FileChange } from '#shared/types'
33
import { createDiff, insertSkipBlocks, countDiffStats } from '#shared/utils/diff'
4-
// @ts-expect-error: (tasky): idk why this is type-erroring even if it has types? /shrug
54
import { motion } from 'motion-v'
65
76
const props = defineProps<{
@@ -68,6 +67,12 @@ async function fetchFileContent(version: string): Promise<string | null> {
6867
}
6968
7069
return text
70+
} catch (err) {
71+
// Provide specific error message for timeout
72+
if (err instanceof Error && err.name === 'AbortError') {
73+
throw new Error(`Request timed out after ${DIFF_TIMEOUT / 1000}s`, { cause: err })
74+
}
75+
throw err
7176
} finally {
7277
clearTimeout(timeoutId)
7378
}
@@ -80,7 +85,10 @@ function computeDiff() {
8085
const oldContent = fromContent.value ?? ''
8186
const newContent = toContent.value ?? ''
8287
83-
// Determine type
88+
// Determine diff type based on content availability
89+
// Note: FileDiffResponse uses 'add'/'delete'/'modify' while FileChange uses
90+
// 'added'/'removed'/'modified' - this is intentional to distinguish between
91+
// the file-level change info (FileChange) and the diff content type (FileDiff)
8492
let type: FileDiffResponse['type'] = 'modify'
8593
if (fromContent.value === null && toContent.value !== null) type = 'add'
8694
else if (fromContent.value !== null && toContent.value === null) type = 'delete'

app/pages/compare/[...path].vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ definePageMeta({
77
})
88
99
const route = useRoute('compare')
10-
const { t } = useI18n()
1110
1211
// Parse package name and version range from URL
1312
// Patterns:
@@ -155,11 +154,6 @@ const toVersionUrlPattern = computed(() => {
155154
return `/compare/${packageName.value}/v/${fromVersion.value}...{version}`
156155
})
157156
158-
function getCodeUrl(version: string, path?: string): string {
159-
const base = `/code/${packageName.value}/v/${version}`
160-
return path ? `${base}/${path}` : base
161-
}
162-
163157
function packageRoute(ver?: string | null) {
164158
const segments = packageName.value.split('/')
165159
if (ver) segments.push('v', ver)

0 commit comments

Comments
 (0)