diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-14 23:24:47 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-16 22:00:30 +0100 |
commit | c06723c44afbc16cf85d316fb086887c18de09c7 (patch) | |
tree | 514848f120c78b6e1970cf7ff1ba62ef1328dfa2 /apps/files/src/components/FileEntry/FileEntryActions.vue | |
parent | 67a02fa611c8a88dc500cff2c93033bb3db436b7 (diff) | |
download | nextcloud-server-c06723c44afbc16cf85d316fb086887c18de09c7.tar.gz nextcloud-server-c06723c44afbc16cf85d316fb086887c18de09c7.zip |
refactor(files): Adjust `useNavigation` composable to enforce active view
In some cases it is guaranteed that we have a proper active view,
e.g. when the file list is loaded (so within FileEntry* components).
This does not change anything but the Typescript types,
so the `currentView` is typed as `View` instead of `View | null“.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src/components/FileEntry/FileEntryActions.vue')
-rw-r--r-- | apps/files/src/components/FileEntry/FileEntryActions.vue | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue index 06b447295eb..8c150b78087 100644 --- a/apps/files/src/components/FileEntry/FileEntryActions.vue +++ b/apps/files/src/components/FileEntry/FileEntryActions.vue @@ -77,8 +77,8 @@ </template> <script lang="ts"> -import type { PropType, ShallowRef } from 'vue' -import type { FileAction, Node, View } from '@nextcloud/files' +import type { PropType } from 'vue' +import type { FileAction, Node } from '@nextcloud/files' import { DefaultType, NodeStatus } from '@nextcloud/files' import { showError, showSuccess } from '@nextcloud/dialogs' @@ -133,12 +133,12 @@ export default defineComponent({ }, setup() { - const { currentView } = useNavigation() + // The file list is guaranteed to be only shown with active view - thus we can set the `loaded` flag + const { currentView } = useNavigation(true) const enabledFileActions = inject<FileAction[]>('enabledFileActions', []) return { - // The file list is guaranteed to be only shown with active view - currentView: currentView as ShallowRef<View>, + currentView, enabledFileActions, } }, |