fix(files): use the configured default view for redirect

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/53824/head
Ferdinand Thiessen 2025-07-04 18:36:31 +07:00 committed by skjnldsv
parent 92f034ecd5
commit 33a69bf985
1 changed files with 8 additions and 7 deletions

@ -184,19 +184,20 @@ import ListViewIcon from 'vue-material-design-icons/FormatListBulletedSquare.vue
import ViewGridIcon from 'vue-material-design-icons/ViewGrid.vue'
import { action as sidebarAction } from '../actions/sidebarAction.ts'
import { getSummaryFor } from '../utils/fileUtils.ts'
import { humanizeWebDAVError } from '../utils/davUtils.ts'
import { useFileListWidth } from '../composables/useFileListWidth.ts'
import { useFilesStore } from '../store/files.ts'
import { useFiltersStore } from '../store/filters.ts'
import { useNavigation } from '../composables/useNavigation.ts'
import { usePathsStore } from '../store/paths.ts'
import { useRouteParameters } from '../composables/useRouteParameters.ts'
import { useActiveStore } from '../store/active.ts'
import { useFilesStore } from '../store/files.ts'
import { useFiltersStore } from '../store/filters.ts'
import { usePathsStore } from '../store/paths.ts'
import { useSelectionStore } from '../store/selection.ts'
import { useUploaderStore } from '../store/uploader.ts'
import { useUserConfigStore } from '../store/userconfig.ts'
import { useViewConfigStore } from '../store/viewConfig.ts'
import { humanizeWebDAVError } from '../utils/davUtils.ts'
import { getSummaryFor } from '../utils/fileUtils.ts'
import { defaultView } from '../utils/filesViews.ts'
import BreadCrumbs from '../components/BreadCrumbs.vue'
import DragAndDropNotice from '../components/DragAndDropNotice.vue'
import FilesListVirtual from '../components/FilesListVirtual.vue'
@ -609,14 +610,14 @@ export default defineComponent({
const currentView = this.currentView
if (!currentView) {
logger.debug('The current view doesn\'t exists or is not ready.', { currentView })
logger.debug('The current view does not exists or is not ready.', { currentView })
// If we still haven't a valid view, let's wait for the page to load
// then try again. Else redirect to the default view
window.addEventListener('DOMContentLoaded', () => {
if (!this.currentView) {
logger.warn('No current view after DOMContentLoaded, redirecting to the default view')
window.OCP.Files.Router.goToRoute(null, { view: 'files' })
window.OCP.Files.Router.goToRoute(null, { view: defaultView() })
}
}, { once: true })
return