MT#63384 Fix Group Details page crash upon refresh

Fixed an issue where the component tried to access the `id` property
of `this.groupSelected` when it was undefined. This happened because
the state gets cleared on refresh, and the component didn't have a
check to reload the necessary resources.

- Added check to ensure resources are reloaded if state is cleared
- Prevent accessing `id` of undefined in the component

Change-Id: Ib6b669df87d255cf174254b32fa1c451d0901f73
master
Debora Crescenzo 3 weeks ago
parent 05854f4871
commit 4e72e67697

@ -386,7 +386,8 @@ export default {
'isGroupLoading', 'isGroupLoading',
'getHuntCancelModeOptions', 'getHuntCancelModeOptions',
'getAnnouncementCfu', 'getAnnouncementCfu',
'getAnnouncementCallSetup' 'getAnnouncementCallSetup',
'isGroupMapByIdEmpty'
]), ]),
...mapGetters('callForwarding', [ ...mapGetters('callForwarding', [
'groups' 'groups'
@ -466,7 +467,10 @@ export default {
} }
} }
}, },
async mounted () { async mounted () {
if (this.isGroupMapByIdEmpty) {
await this.loadGroupListItems()
}
this.selectGroup(this.id) this.selectGroup(this.id)
await this.loadMappingsFull(this.id) await this.loadMappingsFull(this.id)
}, },
@ -493,7 +497,8 @@ export default {
'setGroupNumbers', 'setGroupNumbers',
'setGroupSoundSet', 'setGroupSoundSet',
'setAnnouncementCallSetup', 'setAnnouncementCallSetup',
'setAnnouncementCfu' 'setAnnouncementCfu',
'loadGroupListItems'
]), ]),
...mapActions('pbxCallQueues', [ ...mapActions('pbxCallQueues', [
'jumpToCallQueue' 'jumpToCallQueue'

@ -52,6 +52,9 @@ export default {
getters.isGroupRemoving || getters.isGroupUpdating getters.isGroupRemoving || getters.isGroupUpdating
return !getters.isGroupListEmpty && requesting && state.groupListLastPage > 1 return !getters.isGroupListEmpty && requesting && state.groupListLastPage > 1
}, },
isGroupMapByIdEmpty (state) {
return Object.keys(state.groupMapById).length === 0
},
isGroupAddFormDisabled (state) { isGroupAddFormDisabled (state) {
return state.groupCreationState === CreationState.initiated || return state.groupCreationState === CreationState.initiated ||
state.groupCreationState === CreationState.created state.groupCreationState === CreationState.created

Loading…
Cancel
Save