feat: use klona instead of lodash.clonedeep (#3073)
continuous-integration/drone/push Build is passing Details

Resolves: #3032
Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: #3073
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni 2023-02-07 13:04:03 +00:00 committed by konrad
parent b45a4e1aaf
commit 7b96397e3b
6 changed files with 17 additions and 16 deletions

View File

@ -75,7 +75,7 @@
"focus-within": "3.0.2",
"highlight.js": "11.7.0",
"is-touch-device": "1.0.1",
"lodash.clonedeep": "4.5.0",
"klona": "2.0.6",
"lodash.debounce": "4.0.8",
"marked": "4.2.12",
"minimist": "1.2.7",

View File

@ -63,7 +63,7 @@ specifiers:
highlight.js: 11.7.0
histoire: 0.13.0
is-touch-device: 1.0.1
lodash.clonedeep: 4.5.0
klona: 2.0.6
lodash.debounce: 4.0.8
marked: 4.2.12
minimist: 1.2.7
@ -129,7 +129,7 @@ dependencies:
focus-within: 3.0.2
highlight.js: 11.7.0
is-touch-device: 1.0.1
lodash.clonedeep: 4.5.0
klona: 2.0.6
lodash.debounce: 4.0.8
marked: 4.2.12
minimist: 1.2.7
@ -10037,6 +10037,11 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/klona/2.0.6:
resolution: {integrity: sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==}
engines: {node: '>= 8'}
dev: false
/kuler/2.0.0:
resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==}
dev: true
@ -10216,10 +10221,6 @@ packages:
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
dev: true
/lodash.clonedeep/4.5.0:
resolution: {integrity: sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=}
dev: false
/lodash.debounce/4.0.8:
resolution: {integrity: sha1-gteb/zCmfEAF/9XiUVMArZyk168=}

View File

@ -1,6 +1,6 @@
import {computed, readonly, ref} from 'vue'
import {defineStore, acceptHMRUpdate} from 'pinia'
import cloneDeep from 'lodash.clonedeep'
import {klona} from 'klona/lite'
import {findById, findIndexById} from '@/helpers/utils'
import {i18n} from '@/i18n'
@ -333,7 +333,7 @@ export const useKanbanStore = defineStore('kanban', () => {
const cancel = setModuleLoading(setIsLoading)
const bucketIndex = findIndexById(buckets.value, updatedBucketData.id)
const oldBucket = cloneDeep(buckets.value[bucketIndex])
const oldBucket = klona(buckets.value[bucketIndex])
const updatedBucket = {
...oldBucket,

View File

@ -227,7 +227,7 @@
import {computed, nextTick, ref, watch, type PropType} from 'vue'
import {useI18n} from 'vue-i18n'
import draggable from 'zhyswan-vuedraggable'
import cloneDeep from 'lodash.clonedeep'
import {klona} from 'klona/lite'
import {RIGHTS as Rights} from '@/constants/rights'
import BucketModel from '@/models/bucket'
@ -419,7 +419,7 @@ async function updateTaskPosition(e) {
const taskAfter = newBucket.tasks[newTaskIndex + 1] ?? null
taskUpdating.value[task.id] = true
const newTask = cloneDeep(task) // cloning the task to avoid pinia store manipulation
const newTask = klona(task) // cloning the task to avoid pinia store manipulation
newTask.bucketId = newBucket.id
newTask.kanbanPosition = calculateItemPosition(
taskBefore !== null ? taskBefore.kanbanPosition : null,
@ -432,7 +432,7 @@ async function updateTaskPosition(e) {
// Make sure the first and second task don't both get position 0 assigned
if(newTaskIndex === 0 && taskAfter !== null && taskAfter.kanbanPosition === 0) {
const taskAfterAfter = newBucket.tasks[newTaskIndex + 2] ?? null
const newTaskAfter = cloneDeep(taskAfter) // cloning the task to avoid pinia store manipulation
const newTaskAfter = klona(taskAfter) // cloning the task to avoid pinia store manipulation
newTaskAfter.bucketId = newBucket.id
newTaskAfter.kanbanPosition = calculateItemPosition(
0,

View File

@ -1,5 +1,5 @@
import {computed, ref, shallowReactive, watch, type Ref} from 'vue'
import cloneDeep from 'lodash.clonedeep'
import {klona} from 'klona/lite'
import type {Filters} from '@/composables/useRouteFilters'
import type {ITask, ITaskPartialWithId} from '@/modelTypes/ITask'
@ -64,7 +64,7 @@ export function useGanttTaskList<F extends Filters>(
}
async function updateTask(task: ITaskPartialWithId) {
const oldTask = cloneDeep(tasks.value.get(task.id))
const oldTask = klona(tasks.value.get(task.id))
if (!oldTask) return

View File

@ -449,7 +449,7 @@ import {ref, reactive, toRef, shallowReactive, computed, watch, nextTick, type P
import {useRouter, type RouteLocation} from 'vue-router'
import {useI18n} from 'vue-i18n'
import {unrefElement} from '@vueuse/core'
import cloneDeep from 'lodash.clonedeep'
import {klona} from 'klona/lite'
import TaskService from '@/services/task'
import TaskModel, {TASK_DEFAULT_COLOR} from '@/models/task'
@ -703,7 +703,7 @@ async function saveTask(args?: {
undoCallback,
} = {
...{
task: cloneDeep(task),
task: klona(task),
},
...args,
}