]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): dir contents variables
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Sat, 12 Aug 2023 15:08:25 +0000 (17:08 +0200)
committerJohn Molakvoæ <skjnldsv@protonmail.com>
Thu, 17 Aug 2023 16:56:38 +0000 (18:56 +0200)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/files/src/views/FilesList.vue

index ae93642f9854864218a0fc1ac04337b07305e41a..eb38d09e290a374c8a6965f42b6348d3330e9826 100644 (file)
@@ -58,7 +58,7 @@
                        ref="filesListVirtual"
                        :current-folder="currentFolder"
                        :current-view="currentView"
-                       :nodes="dirContents" />
+                       :nodes="dirContentsSorted" />
        </NcAppContent>
 </template>
 
@@ -163,7 +163,7 @@ export default Vue.extend({
                /**
                 * The current directory contents.
                 */
-               dirContents(): Node[] {
+               dirContentsSorted(): Node[] {
                        if (!this.currentView) {
                                return []
                        }
@@ -173,8 +173,7 @@ export default Vue.extend({
 
                        // Custom column must provide their own sorting methods
                        if (customColumn?.sort && typeof customColumn.sort === 'function') {
-                               const results = [...(this.currentFolder?._children || []).map(this.getNode).filter(file => file)]
-                                       .sort(customColumn.sort)
+                               const results = [...this.dirContents].sort(customColumn.sort)
                                return this.isAscSorting ? results : results.reverse()
                        }
 
@@ -193,12 +192,16 @@ export default Vue.extend({
                        const orders = new Array(identifiers.length).fill(this.isAscSorting ? 'asc' : 'desc')
 
                        return orderBy(
-                               [...(this.currentFolder?._children || []).map(this.getNode).filter(file => file)],
+                               [...this.dirContents],
                                identifiers,
                                orders,
                        )
                },
 
+               dirContents(): Node[] {
+                       return (this.currentFolder?._children || []).map(this.getNode).filter(file => file)
+               },
+
                /**
                 * The current directory is empty.
                 */