aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-08-14 09:43:27 +0200
committerGitHub <noreply@github.com>2024-08-14 09:43:27 +0200
commit4920f9049503cc71b3d202786bb0582e75746d60 (patch)
treea1df47a7d82ed029d25b0ff03104ce414c70b1b9 /apps/files/src
parent1f1cb6da4843e2d16bf0e1cb48821a0d7d70a84e (diff)
parent46bb8ef04d33a75d5b59c3f63af518afba3dac40 (diff)
downloadnextcloud-server-4920f9049503cc71b3d202786bb0582e75746d60.tar.gz
nextcloud-server-4920f9049503cc71b3d202786bb0582e75746d60.zip
Merge pull request #47016 from nextcloud/refactor/cleanup-files-view
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/components/FilesListVirtual.vue31
1 files changed, 20 insertions, 11 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue
index 9a35e9ff855..cb38d744738 100644
--- a/apps/files/src/components/FilesListVirtual.vue
+++ b/apps/files/src/components/FilesListVirtual.vue
@@ -64,7 +64,6 @@ import type { UserConfig } from '../types'
import { getFileListHeaders, Folder, View, getFileActions, FileType } from '@nextcloud/files'
import { showError } from '@nextcloud/dialogs'
-import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { defineComponent } from 'vue'
@@ -190,14 +189,23 @@ export default defineComponent({
},
watch: {
- fileId(fileId) {
- this.scrollToFile(fileId, false)
+ fileId: {
+ handler(fileId) {
+ this.scrollToFile(fileId, false)
+ },
+ immediate: true,
},
- openFile(open: boolean) {
- if (open) {
- this.$nextTick(() => this.handleOpenFile(this.fileId))
- }
+ openFile: {
+ handler() {
+ // wait for scrolling and updating the actions to settle
+ this.$nextTick(() => {
+ if (this.fileId && this.openFile) {
+ this.handleOpenFile(this.fileId)
+ }
+ })
+ },
+ immediate: true,
},
},
@@ -206,10 +214,11 @@ export default defineComponent({
const mainContent = window.document.querySelector('main.app-content') as HTMLElement
mainContent.addEventListener('dragover', this.onDragOver)
- const { id } = loadState<{ id?: number }>('files', 'fileInfo', {})
- this.scrollToFile(id ?? this.fileId)
- this.openSidebarForFile(id ?? this.fileId)
- this.handleOpenFile(id ?? null)
+ // If the file list is mounted with a fileId specified
+ // then we need to open the sidebar initially
+ if (this.fileId) {
+ this.openSidebarForFile(this.fileId)
+ }
},
beforeDestroy() {