Merge pull request #55737 from nextcloud/backport/55666/stable31

pull/55464/head
Maksim Sukharev 2025-10-14 15:53:06 +07:00 committed by GitHub
commit 32264c7e0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 4 deletions

@ -8,11 +8,29 @@ import { watchThrottled } from '@vueuse/core'
import { onMounted, onUnmounted, ref } from 'vue'
import { FilenameFilter } from '../filters/FilenameFilter'
const searchQuery = ref('')
/**
* This is for the non-component usage to modify the query
*/
export function useSearchQuery() {
/**
* Updating the search query ref
* @param value The new value
*/
function updateQuery(value: string) {
searchQuery.value = value
}
return {
updateQuery,
}
}
/**
* This is for the `Navigation` component to provide a filename filter
*/
export function useFilenameFilter() {
const searchQuery = ref('')
const filenameFilter = new FilenameFilter()
/**

@ -11,6 +11,7 @@ import Router, { isNavigationFailure, NavigationFailureType } from 'vue-router'
import Vue from 'vue'
import { useFilesStore } from '../store/files'
import { useSearchQuery } from '../composables/useFilenameFilter'
import { useNavigation } from '../composables/useNavigation'
import { usePathsStore } from '../store/paths'
import logger from '../logger'
@ -87,6 +88,12 @@ router.beforeEach((to, from, next) => {
const fromDir = (from.query?.dir || '/') as string
const toDir = (to.query?.dir || '/') as string
if (fromDir !== toDir) {
// we navigate to another directory -> unset the query
const { updateQuery } = useSearchQuery()
updateQuery('')
}
// We are going back to a parent directory
if (relative(fromDir, toDir) === '..') {
const { currentView } = useNavigation()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long