Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci] Optimize share loading part II #7638

Merged
merged 21 commits into from
Sep 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unneeded loading states
  • Loading branch information
JammingBen committed Sep 14, 2022
commit 093dfb8f9967c233ba50a9b25cd687b317918b9f
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import { computed, defineComponent, unref } from '@vue/composition-api'
import FileLinks from './FileLinks.vue'
import FileShares from './FileShares.vue'
import SpaceMembers from './SpaceMembers.vue'
import { mapGetters, mapState } from 'vuex'
import { mapState } from 'vuex'
import { useStore } from 'web-pkg/src/composables'
import { useIncomingParentShare } from '../../../composables/parentShare'

@@ -41,26 +41,15 @@ export default defineComponent({
},
setup() {
const store = useStore()
const currentFileOutgoingSharesLoading = computed(
() => store.getters['Files/currentFileOutgoingSharesLoading']
)
const incomingSharesLoading = computed(() => store.getters['Files/incomingSharesLoading'])
const sharesTreeLoading = computed(() => store.getters['Files/sharesTreeLoading'])
const sharesLoading = computed(
() =>
unref(currentFileOutgoingSharesLoading) ||
unref(incomingSharesLoading) ||
unref(sharesTreeLoading)
)
const sharesLoading = computed(() => store.getters['Files/sharesTreeLoading'])

return {
...useIncomingParentShare(),
sharesLoading
}
},
computed: {
...mapGetters('Files', ['currentFileOutgoingSharesLoading']),
...mapState('Files', ['incomingSharesLoading', 'sharesTreeLoading'])
...mapState('Files', ['sharesTreeLoading'])
},
watch: {
sharesLoading: {
2 changes: 0 additions & 2 deletions packages/web-app-files/src/store/actions.ts
Original file line number Diff line number Diff line change
@@ -456,9 +456,7 @@ export default {
context.commit('SHARESTREE_ADD', sharesTree)
context.commit('SHARESTREE_LOADING', false)
context.commit('CURRENT_FILE_OUTGOING_SHARES_SET', outgoingShares)
context.commit('CURRENT_FILE_OUTGOING_SHARES_LOADING', false)
context.commit('INCOMING_SHARES_LOAD', incomingShares)
context.commit('INCOMING_SHARES_LOADING', false)
})
},
async loadVersions(context, { client, fileId }) {
3 changes: 0 additions & 3 deletions packages/web-app-files/src/store/getters.ts
Original file line number Diff line number Diff line change
@@ -49,9 +49,6 @@ export default {
return ShareTypes.containsAnyValue(ShareTypes.unauthenticated, [share.shareType])
})
},
currentFileOutgoingSharesLoading: (state) => {
return state.currentFileOutgoingSharesLoading
},
sharesTree: (state) => state.sharesTree,
sharesTreeLoading: (state) => state.sharesTreeLoading,
quota: (state) => {
6 changes: 0 additions & 6 deletions packages/web-app-files/src/store/mutations.ts
Original file line number Diff line number Diff line change
@@ -120,19 +120,13 @@ export default {
state.currentFileOutgoingShares = []
state.currentFileOutgoingSharesError = error
},
CURRENT_FILE_OUTGOING_SHARES_LOADING(state, loading) {
state.currentFileOutgoingSharesLoading = loading
},
INCOMING_SHARES_LOAD(state, shares) {
state.incomingShares = shares
},
INCOMING_SHARES_ERROR(state, error) {
state.incomingShares = []
state.incomingSharesError = error
},
INCOMING_SHARES_LOADING(state, loading) {
state.incomingSharesLoading = loading
},
SHARESTREE_PRUNE_OUTSIDE_PATH(state, pathToKeep) {
if (pathToKeep !== '' && pathToKeep !== '/') {
// clear all children unrelated to the given path
2 changes: 0 additions & 2 deletions packages/web-app-files/src/store/state.ts
Original file line number Diff line number Diff line change
@@ -13,14 +13,12 @@ export default {
*/
currentFileOutgoingShares: [],
currentFileOutgoingSharesError: null,
currentFileOutgoingSharesLoading: false,

/**
* Incoming shares from currently highlighted element
*/
incomingShares: [],
incomingSharesError: null,
incomingSharesLoading: false,

/**
* Shares from parent folders
Original file line number Diff line number Diff line change
@@ -141,7 +141,6 @@ describe('FileLinks', () => {
isFolder: false,
isReceivedShare: jest.fn()
},
currentFileOutgoingSharesLoading = false,
sharesTreeLoading = false,
expireDate = {
enabled: true,
@@ -193,7 +192,6 @@ describe('FileLinks', () => {
currentFileOutgoingLinks: function () {
return links
},
currentFileOutgoingSharesLoading: jest.fn(() => currentFileOutgoingSharesLoading),
sharesTreeLoading: jest.fn(() => sharesTreeLoading)
},
actions: mapActions,
Original file line number Diff line number Diff line change
@@ -209,7 +209,6 @@ const storeOptions = (data) => {
return getResource({ filename: 'testfile', extension: 'jpg', type: 'file', canShare })
},
currentFileOutgoingCollaborators: () => outgoingCollaborators,
currentFileOutgoingSharesLoading: () => false,
sharesTreeLoading: () => false
},
actions: {
Original file line number Diff line number Diff line change
@@ -53,8 +53,7 @@ describe('SharesPanel', () => {
getters: {
highlightedFile: (state) => {
return state.highlightedFile
},
currentFileOutgoingSharesLoading: jest.fn()
}
},
mutations: {
SET_HIGHLIGHTED_FILE(state, file) {
Original file line number Diff line number Diff line change
@@ -148,7 +148,6 @@ const storeOptions = (data, isInLoadingState) => {
namespaced: true,
getters: {
highlightedFile: () => spaceMock,
currentFileOutgoingSharesLoading: () => isInLoadingState,
sharesTreeLoading: () => false
},
actions: {