From 8b5850e235e4e3b46460e6dee154645511824c2c Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Thu, 17 Mar 2022 12:58:03 +0100 Subject: [PATCH] Re-use 'sameRoute' param instead of introducing a new one --- .../unreleased/enhancement-improve-space-resource-loading | 2 +- packages/web-app-files/src/services/folder/loaderProject.ts | 6 +++--- packages/web-app-files/src/views/spaces/Project.vue | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/changelog/unreleased/enhancement-improve-space-resource-loading b/changelog/unreleased/enhancement-improve-space-resource-loading index 1b25548faa7..7e87ec4450e 100644 --- a/changelog/unreleased/enhancement-improve-space-resource-loading +++ b/changelog/unreleased/enhancement-improve-space-resource-loading @@ -2,7 +2,7 @@ Enhancement: Improve resource loading within spaces We've improved the loading of resources within a space. This enhances performance and overall stability within spaces. -* A new parameter was introduced to determine if a space needs to be fetched or not. Route changes within a space do not require the space the be fetched again. This also ensures that the space image and readme won't be fetched in subfolders. +* The loading task will determine if a space needs to be fetched or not. Route changes within a space do not require the space the be fetched again. This also ensures that the space image and readme won't be fetched when navigating into subfolders. * The space now gets set at the end of the loading task. This ensures that the space task has finished as soon as the image and readme get loaded. https://github.com/owncloud/web/pull/6601 diff --git a/packages/web-app-files/src/services/folder/loaderProject.ts b/packages/web-app-files/src/services/folder/loaderProject.ts index 7981ddcb9ce..63f2de369a4 100644 --- a/packages/web-app-files/src/services/folder/loaderProject.ts +++ b/packages/web-app-files/src/services/folder/loaderProject.ts @@ -14,11 +14,11 @@ export class FolderLoaderProject implements FolderLoader { const router = context.router const store = context.store - return useTask(function* (signal1, signal2, ref, sameRoute, path = null, fetchSpace = true) { + return useTask(function* (signal1, signal2, ref, sameRoute, path = null) { ref.CLEAR_CURRENT_FILES_LIST() let space - if (fetchSpace) { + if (!sameRoute) { const graphClient = clientService.graphAuthenticated( store.getters.configuration.server, store.getters.getToken @@ -63,7 +63,7 @@ export class FolderLoaderProject implements FolderLoader { currentFolder: currentFolder?.path }) - if (fetchSpace) { + if (!sameRoute) { ref.space = space } }) diff --git a/packages/web-app-files/src/views/spaces/Project.vue b/packages/web-app-files/src/views/spaces/Project.vue index b92440fd3ff..6c47e7fbd98 100644 --- a/packages/web-app-files/src/views/spaces/Project.vue +++ b/packages/web-app-files/src/views/spaces/Project.vue @@ -289,11 +289,11 @@ export default { watch: { $route: { handler: async function (to, from) { - const sameRoute = to.name === from?.name + const sameRoute = to.name === from?.name && to.params?.storageId === from?.params?.storageId const sameItem = to.params?.item === from?.params?.item if ((!sameRoute || !sameItem) && from) { - await this.loadResourcesTask.perform(this, sameRoute, to.params.item, false) + await this.loadResourcesTask.perform(this, sameRoute, to.params.item) } if (this.$refs.markdownContainer) {