fix: remove client side sorting of files (#4240)

* fix: remove default sorting on files page

* fix: lint
This commit is contained in:
Cal H.
2025-08-22 18:28:47 +01:00
committed by GitHub
parent 87dbb6dcbc
commit 44cbbd9ed7
2 changed files with 3 additions and 12 deletions

View File

@@ -143,7 +143,7 @@ const codeExtensions = Object.freeze([
'go',
])
const textExtensions = Object.freeze(['txt', 'md', 'log', 'cfg', 'conf', 'properties', 'ini'])
const textExtensions = Object.freeze(['txt', 'md', 'log', 'cfg', 'conf', 'properties', 'ini', 'sk'])
const imageExtensions = Object.freeze(['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'])
const supportedArchiveExtensions = Object.freeze(['zip'])
const units = Object.freeze(['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'])

View File

@@ -393,13 +393,13 @@ const fetchDirectoryContents = async (): Promise<DirectoryResponse> => {
if (currentPage.value === 1) {
return {
items: applyDefaultSort(data.items),
items: data.items,
total: data.total,
}
}
return {
items: [...(directoryData.value?.items || []), ...applyDefaultSort(data.items)],
items: [...(directoryData.value?.items || []), ...data.items],
total: data.total,
}
} catch (error) {
@@ -727,15 +727,6 @@ const handleCreateError = (error: any) => {
}
}
const applyDefaultSort = (items: DirectoryItem[]) => {
return items.sort((a: any, b: any) => {
if (a.type === 'directory' && b.type !== 'directory') return -1
if (a.type !== 'directory' && b.type === 'directory') return 1
return a.name.localeCompare(b.name)
})
}
const handleSort = (field: string) => {
if (sortMethod.value === field) {
sortDesc.value = !sortDesc.value