diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-03 14:04:25 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-08-14 09:31:27 +0200 |
commit | 7fec706f68c8494c601542e0867eccbe24f612c0 (patch) | |
tree | 796a0d4c9e241395e62db137ecda8028b1627c86 /apps/files/src | |
parent | 0c0ba5f552d76424a130414eb32fe1ecf48372ad (diff) | |
download | nextcloud-server-7fec706f68c8494c601542e0867eccbe24f612c0.tar.gz nextcloud-server-7fec706f68c8494c601542e0867eccbe24f612c0.zip |
refactor(files): Drop unneeded initial state
The initial state is no longer used, it was only used in legacy UI and in the f2v rewrite
it was only used for the `id` which can be loaded just from the URL.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
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() { |