3
0

Prevent resolving users if list is empty

This commit is contained in:
Jože Fortun
2023-07-14 17:30:00 +02:00
parent 0c58fc7130
commit 3aa01e7d40
2 changed files with 9 additions and 4 deletions

View File

@@ -32,7 +32,10 @@ export default {
// Dispatch resolution per module
return Promise.all(Object.entries(moduleRecords).map(([moduleID, recordIDs]) => {
recordIDs = [...recordIDs]
return this.$store.dispatch('record/resolveRecords', { namespaceID, moduleID, recordIDs })
if (recordIDs.length) {
return this.$store.dispatch('record/resolveRecords', { namespaceID, moduleID, recordIDs })
}
}))
},
},

View File

@@ -5,7 +5,7 @@ export default {
return
}
const list = new Set(records.map(r => {
const list = [...new Set(records.map(r => {
return fields
.filter(c => c.kind === 'User')
.map(f => {
@@ -15,9 +15,11 @@ export default {
return f.isMulti ? r.values[f.name] : [r.values[f.name]]
}
})
}).flat(Infinity))
}).flat(Infinity))]
return this.$store.dispatch('user/resolveUsers', [...list])
if (list.length) {
return this.$store.dispatch('user/resolveUsers', list)
}
},
},
}