Skip to content

Commit

Permalink
Re-use 'sameRoute' param instead of introducing a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Mar 17, 2022
1 parent 3870f47 commit 2858f5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions packages/web-app-files/src/services/folder/loaderProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -63,7 +63,7 @@ export class FolderLoaderProject implements FolderLoader {
currentFolder: currentFolder?.path
})

if (fetchSpace) {
if (!sameRoute) {
ref.space = space
}
})
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-files/src/views/spaces/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2858f5a

Please sign in to comment.