1
0

feat: remove lodash dependency (#743)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/743
Reviewed-by: konrad <k@knt.li>
Co-authored-by: dpschen <dpschen@noreply.kolaente.de>
Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
This commit is contained in:
dpschen
2021-10-06 20:25:06 +00:00
committed by konrad
parent a76d115baf
commit faa2daa876
20 changed files with 116 additions and 89 deletions

View File

@ -1,5 +1,4 @@
import TaskCollectionService from '@/services/taskCollection'
import cloneDeep from 'lodash/cloneDeep'
// FIXME: merge with DEFAULT_PARAMS in filters.vue
const DEFAULT_PARAMS = {
@ -83,7 +82,7 @@ export default {
this.tasks = r
this.currentPage = page
this.loadedList = cloneDeep(currentList)
this.loadedList = JSON.parse(JSON.stringify(currentList))
})
.catch(e => {
this.$message.error(e)

View File

@ -29,8 +29,7 @@
</template>
<script>
import differenceWith from 'lodash/differenceWith'
import {includesById} from '@/helpers/utils'
import UserModel from '../../../models/user'
import ListUserService from '../../../services/listUsers'
import TaskAssigneeService from '../../../services/taskAssignee'
@ -111,9 +110,9 @@ export default {
this.listUserService.getAll({listId: this.listId}, {s: query})
.then(response => {
// Filter the results to not include users who are already assigned
this.$set(this, 'foundUsers', differenceWith(response, this.assignees, (first, second) => {
return first.id === second.id
}))
const filteredResponse = response.filter(({id}) => !includesById(this.assignees, id))
this.$set(this, 'foundUsers', filteredResponse)
})
.catch(e => {
this.$message.error(e)

View File

@ -38,8 +38,6 @@
</template>
<script>
import differenceWith from 'lodash/differenceWith'
import LabelModel from '../../../models/label'
import LabelTaskService from '../../../services/labelTask'
@ -83,13 +81,7 @@ export default {
},
computed: {
foundLabels() {
const labels = (Object.values(this.$store.state.labels.labels).filter(l => {
return l.title.toLowerCase().includes(this.query.toLowerCase())
}) ?? [])
return differenceWith(labels, this.labels, (first, second) => {
return first.id === second.id
})
return this.$store.getters['labels/filterLabelsByQuery'](this.labels, this.query)
},
loading() {
return this.labelTaskService.loading || (this.$store.state[LOADING] && this.$store.state[LOADING_MODULE] === 'labels')