diff options
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 31 |
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() { |