Skip to content

Commit

Permalink
Remove unneeded loading states
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Sep 14, 2022
1 parent b88ab44 commit 093dfb8
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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: {
Expand Down
2 changes: 0 additions & 2 deletions packages/web-app-files/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
3 changes: 0 additions & 3 deletions packages/web-app-files/src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 0 additions & 6 deletions packages/web-app-files/src/store/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions packages/web-app-files/src/store/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ describe('FileLinks', () => {
isFolder: false,
isReceivedShare: jest.fn()
},
currentFileOutgoingSharesLoading = false,
sharesTreeLoading = false,
expireDate = {
enabled: true,
Expand Down Expand Up @@ -193,7 +192,6 @@ describe('FileLinks', () => {
currentFileOutgoingLinks: function () {
return links
},
currentFileOutgoingSharesLoading: jest.fn(() => currentFileOutgoingSharesLoading),
sharesTreeLoading: jest.fn(() => sharesTreeLoading)
},
actions: mapActions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ const storeOptions = (data) => {
return getResource({ filename: 'testfile', extension: 'jpg', type: 'file', canShare })
},
currentFileOutgoingCollaborators: () => outgoingCollaborators,
currentFileOutgoingSharesLoading: () => false,
sharesTreeLoading: () => false
},
actions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ describe('SharesPanel', () => {
getters: {
highlightedFile: (state) => {
return state.highlightedFile
},
currentFileOutgoingSharesLoading: jest.fn()
}
},
mutations: {
SET_HIGHLIGHTED_FILE(state, file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ const storeOptions = (data, isInLoadingState) => {
namespaced: true,
getters: {
highlightedFile: () => spaceMock,
currentFileOutgoingSharesLoading: () => isInLoadingState,
sharesTreeLoading: () => false
},
actions: {
Expand Down

0 comments on commit 093dfb8

Please sign in to comment.