diff --git a/services/web/frontend/js/features/history/components/file-tree/history-file-tree-folder-list.tsx b/services/web/frontend/js/features/history/components/file-tree/history-file-tree-folder-list.tsx
index 7f6c52476b..aeea5e1adb 100644
--- a/services/web/frontend/js/features/history/components/file-tree/history-file-tree-folder-list.tsx
+++ b/services/web/frontend/js/features/history/components/file-tree/history-file-tree-folder-list.tsx
@@ -2,7 +2,6 @@ import classNames from 'classnames'
import HistoryFileTreeDoc from './history-file-tree-doc'
import HistoryFileTreeFolder from './history-file-tree-folder'
-import { fileCollator } from '../../../file-tree/util/file-collator'
import type { ReactNode } from 'react'
import type { HistoryFileTree, HistoryDoc } from '../../utils/file-tree'
@@ -21,29 +20,18 @@ export default function HistoryFileTreeFolderList({
}: HistoryFileTreeFolderListProps) {
return (
- {folders.sort(compareFunction).map(folder => {
- return (
-
- )
- })}
- {docs.sort(compareFunction).map(doc => {
- return (
-
- )
- })}
+ {folders.map(folder => (
+
+ ))}
+ {docs.map(doc => (
+
+ ))}
{children}
)
}
-
-function compareFunction(
- one: HistoryFileTree | HistoryDoc,
- two: HistoryFileTree | HistoryDoc
-) {
- return fileCollator.compare(one.name, two.name)
-}
diff --git a/services/web/frontend/js/features/history/components/history-file-tree.tsx b/services/web/frontend/js/features/history/components/history-file-tree.tsx
index 8433a4b8c9..3bccf40e3a 100644
--- a/services/web/frontend/js/features/history/components/history-file-tree.tsx
+++ b/services/web/frontend/js/features/history/components/history-file-tree.tsx
@@ -1,4 +1,4 @@
-import _ from 'lodash'
+import { orderBy, reduce } from 'lodash'
import { useHistoryContext } from '../context/history-context'
import {
fileTreeDiffToFileTreeData,
@@ -9,9 +9,11 @@ import HistoryFileTreeFolderList from './file-tree/history-file-tree-folder-list
export default function HistoryFileTree() {
const { selection, error } = useHistoryContext()
- const fileTree = _.reduce(selection.files, reducePathsToTree, [])
+ const fileTree = reduce(selection.files, reducePathsToTree, [])
- const mappedFileTree = fileTreeDiffToFileTreeData(fileTree)
+ const sortedFileTree = orderBy(fileTree, ['-type', 'operation', 'name'])
+
+ const mappedFileTree = fileTreeDiffToFileTreeData(sortedFileTree)
return error ? null : (