diff --git a/changelog/unreleased/bugfix-overlapping-view-requests b/changelog/unreleased/bugfix-overlapping-view-requests new file mode 100644 index 00000000000..93d19ba290f --- /dev/null +++ b/changelog/unreleased/bugfix-overlapping-view-requests @@ -0,0 +1,10 @@ +Bugfix: Fix overlapping requests in files app + +In some cases the files app tended to display the wrong resources when navigating quickly through the views. This happened because the resource provisioning step wasn't canceled. +This is now fixed by using vue-concurrency which on a high level wraps iterable generators which are cancelable. We're using it to wrap the resource loading and cancel it as soon as the resource set is not needed anymore. + +It also improves the overall performance for the files app. + +https://github.com/owncloud/web/pull/5917 +https://github.com/owncloud/web/issues/5085 +https://github.com/owncloud/web/issues/5875 diff --git a/packages/web-app-external/src/store/index.ts b/packages/web-app-external/src/store/index.ts index 9149fceee38..65c510679c7 100644 --- a/packages/web-app-external/src/store/index.ts +++ b/packages/web-app-external/src/store/index.ts @@ -1,9 +1,16 @@ -const state = { +import { Commit } from 'vuex' +const State = { mimeTypes: {} } const actions = { - async fetchMimeTypes({ rootGetters, commit }): Promise { + async fetchMimeTypes({ + rootGetters, + commit + }: { + rootGetters: any + commit: Commit + }): Promise { if (!rootGetters.capabilities.files.app_providers[0]?.enabled) { return } @@ -23,20 +30,20 @@ const actions = { } const getters = { - getMimeTypes: (state) => { + getMimeTypes: (state: typeof State): { [key: string]: string } => { return state.mimeTypes } } const mutations = { - SET_MIME_TYPES(state, mimeTypes): void { + SET_MIME_TYPES(state: typeof State, mimeTypes: { [key: string]: string }): void { state.mimeTypes = mimeTypes } } export default { namespaced: true, - state, + state: State, actions, mutations, getters diff --git a/packages/web-app-files/src/views/Favorites.vue b/packages/web-app-files/src/views/Favorites.vue index 9c3d764db41..e9ea12e4b0b 100644 --- a/packages/web-app-files/src/views/Favorites.vue +++ b/packages/web-app-files/src/views/Favorites.vue @@ -1,6 +1,6 @@