diff --git a/src/components/top-matter/FolderDynamicTopMatter.vue b/src/components/top-matter/FolderDynamicTopMatter.vue index f4ba8e1b..8b12bca9 100644 --- a/src/components/top-matter/FolderDynamicTopMatter.vue +++ b/src/components/top-matter/FolderDynamicTopMatter.vue @@ -20,6 +20,7 @@ export default defineComponent({ data: () => ({ folders: [] as IFolder[], + currentFolder: '', }), components: { @@ -30,11 +31,15 @@ export default defineComponent({ methods: { async refresh(): Promise { - // Clear folders - this.folders = []; + const folder = utils.getFolderRoutePath(this.config.folders_path); + + // Clear folders if switching to a different folder, otherwise just refresh + if (this.currentFolder === folder) { + this.currentFolder = folder; + this.folders = []; + } // Get subfolders URL - const folder = utils.getFolderRoutePath(this.config.folders_path); const url = API.Q(API.FOLDERS_SUB(), { folder }); // Make API call to get subfolders diff --git a/src/components/top-matter/FolderTopMatter.vue b/src/components/top-matter/FolderTopMatter.vue index eac819b8..70920cd3 100644 --- a/src/components/top-matter/FolderTopMatter.vue +++ b/src/components/top-matter/FolderTopMatter.vue @@ -84,7 +84,7 @@ export default defineComponent({ }, recursive(): boolean { - return this.$route.query.recursive === '1'; + return !!this.$route.query.recursive; }, }, @@ -94,7 +94,12 @@ export default defineComponent({ }, toggleRecursive() { - this.$router.replace({ query: this.recursive ? {} : { recursive: '1' } }); + this.$router.replace({ + query: { + ...this.$router.currentRoute.query, + recursive: this.recursive ? undefined : String(1), + }, + }); }, }, });