Skip to content

Commit 14985cf

Browse files
committed
chore: add motion-v, fix warnings
1 parent cabcb26 commit 14985cf

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

app/components/diff/FileTree.vue

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ const emit = defineEmits<{
2424
2525
const depth = computed(() => props.depth ?? 0)
2626
27+
// Sort: directories first, then alphabetically
28+
function sortTree(nodes: DiffTreeNode[]): DiffTreeNode[] {
29+
return nodes
30+
.map(n => ({
31+
...n,
32+
children: n.children ? sortTree(n.children) : undefined,
33+
}))
34+
.sort((a, b) => {
35+
if (a.type !== b.type) return a.type === 'directory' ? -1 : 1
36+
return a.name.localeCompare(b.name)
37+
})
38+
}
39+
2740
// Build tree structure from flat file list (only at root level)
2841
function buildTree(files: FileChange[]): DiffTreeNode[] {
2942
const root: DiffTreeNode[] = []
@@ -55,19 +68,6 @@ function buildTree(files: FileChange[]): DiffTreeNode[] {
5568
}
5669
}
5770
58-
// Sort: directories first, then alphabetically
59-
function sortTree(nodes: DiffTreeNode[]): DiffTreeNode[] {
60-
return nodes
61-
.map(n => ({
62-
...n,
63-
children: n.children ? sortTree(n.children) : undefined,
64-
}))
65-
.sort((a, b) => {
66-
if (a.type !== b.type) return a.type === 'directory' ? -1 : 1
67-
return a.name.localeCompare(b.name)
68-
})
69-
}
70-
7171
return sortTree(root)
7272
}
7373

server/utils/compare.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ export function flattenTree(tree: PackageFileTree[]): Map<string, PackageFileTre
2121
return result
2222
}
2323

24+
const hasChanged = (fromNode: PackageFileTree, toNode: PackageFileTree): boolean => {
25+
// Prefer strong hash comparison when both hashes are available
26+
if (fromNode.hash && toNode.hash) return fromNode.hash !== toNode.hash
27+
// Fallback to size comparison if hashes are missing
28+
if (typeof fromNode.size === 'number' && typeof toNode.size === 'number') {
29+
return fromNode.size !== toNode.size
30+
}
31+
// If we lack comparable signals, assume unchanged
32+
return false
33+
}
34+
2435
/** Compare two file trees and return changes */
2536
export function compareFileTrees(
2637
fromTree: PackageFileTree[],
@@ -29,17 +40,6 @@ export function compareFileTrees(
2940
const fromFiles = flattenTree(fromTree)
3041
const toFiles = flattenTree(toTree)
3142

32-
const hasChanged = (fromNode: PackageFileTree, toNode: PackageFileTree): boolean => {
33-
// Prefer strong hash comparison when both hashes are available
34-
if (fromNode.hash && toNode.hash) return fromNode.hash !== toNode.hash
35-
// Fallback to size comparison if hashes are missing
36-
if (typeof fromNode.size === 'number' && typeof toNode.size === 'number') {
37-
return fromNode.size !== toNode.size
38-
}
39-
// If we lack comparable signals, assume unchanged
40-
return false
41-
}
42-
4343
const added: FileChange[] = []
4444
const removed: FileChange[] = []
4545
const modified: FileChange[] = []

0 commit comments

Comments
 (0)