Skip to content

Commit 1d5e2c1

Browse files
fix(files): update loading behavior when changing location
Signed-off-by: Luka Trovic <luka@nextcloud.com>
1 parent e35c0a7 commit 1d5e2c1

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

apps/files/src/components/FilesListVirtual.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:data-component="userConfig.grid_view ? FileEntryGrid : FileEntry"
99
data-key="source"
1010
:data-sources="nodes"
11+
:loading="loading"
1112
:grid-mode="userConfig.grid_view"
1213
:extra-props="{
1314
isMimeAvailable,
@@ -118,6 +119,11 @@ export default defineComponent({
118119
type: String,
119120
required: true,
120121
},
122+
123+
loading: {
124+
type: Boolean,
125+
default: false,
126+
},
121127
},
122128
123129
setup(props) {

apps/files/src/components/VirtualList.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
</div>
1919

2020
<div
21-
v-if="dataSources.length === 0"
21+
v-if="dataSources.length === 0 || loading"
2222
class="files-list__empty">
2323
<slot name="empty" />
2424
</div>
2525

2626
<table
27+
v-if="!loading"
2728
:aria-hidden="dataSources.length === 0"
2829
:inert="dataSources.length === 0"
2930
class="files-list__table"
@@ -123,6 +124,11 @@ export default defineComponent({
123124
type: String,
124125
default: '',
125126
},
127+
128+
loading: {
129+
type: Boolean,
130+
default: false,
131+
},
126132
},
127133
128134
setup() {

apps/files/src/views/FilesList.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<FilesListVirtual
9191
v-else
9292
ref="filesListVirtual"
93+
:loading="loading && !isRefreshing"
9394
:current-folder="currentFolder"
9495
:current-view="currentView"
9596
:nodes="dirContentsSorted"
@@ -311,6 +312,7 @@ export default defineComponent({
311312
312313
loading: true,
313314
loadingAction: null as string | null,
315+
changingLocation: false,
314316
error: null as string | null,
315317
controller: new AbortController(),
316318
promise: null as Promise<ContentsWithRoot> | null,
@@ -410,6 +412,7 @@ export default defineComponent({
410412
return this.currentFolder !== undefined
411413
&& !this.isEmptyDir
412414
&& this.loading
415+
&& !this.changingLocation
413416
},
414417
415418
/**
@@ -476,12 +479,14 @@ export default defineComponent({
476479
}
477480
478481
logger.debug('View changed', { newView, oldView })
482+
this.changingLocation = true
479483
this.selectionStore.reset()
480484
this.fetchContent()
481485
},
482486
483487
directory(newDir, oldDir) {
484488
logger.debug('Directory changed', { newDir, oldDir })
489+
this.changingLocation = true
485490
// TODO: preserve selection on browsing?
486491
this.selectionStore.reset()
487492
this.sidebar.close()
@@ -608,6 +613,7 @@ export default defineComponent({
608613
this.error = humanizeWebDAVError(error)
609614
} finally {
610615
this.loading = false
616+
this.changingLocation = false
611617
}
612618
},
613619

0 commit comments

Comments
 (0)