fix: Replace lodash with es-toolkit/compat in useManagerQueue

Replace lodash import with es-toolkit/compat to match project standards:
- Change 'lodash' import to 'es-toolkit/compat' for pickBy function
- Add specific type helper for history task filtering
- Update JSDoc comment to remove lodash reference
- Fixes component test failures from missing lodash dependency
This commit is contained in:
bymyself
2025-09-01 14:27:59 -07:00
parent a0630cc181
commit 7c88dbc969

View File

@@ -1,5 +1,5 @@
import { useEventListener } from '@vueuse/core'
import { pickBy } from 'lodash'
import { pickBy } from 'es-toolkit/compat'
import { Ref, computed, ref } from 'vue'
import { app } from '@/scripts/app'
@@ -60,6 +60,14 @@ export const useManagerQueue = (
const isTaskFromThisClient = (task: Task): boolean =>
task.client_id === app.api.clientId
/**
* Check if a history task is associated with this client.
* @param task - The history task to check
* @returns True if the task belongs to this client
*/
const isHistoryTaskFromThisClient = (task: HistoryTaskItem): boolean =>
task.client_id === app.api.clientId
/**
* Filter queue tasks by client id.
* Ensures that only tasks associated with this client are processed and
@@ -71,13 +79,13 @@ export const useManagerQueue = (
tasks.filter(isTaskFromThisClient)
/**
* Filter history tasks by client id using lodash pickBy for optimal performance.
* Filter history tasks by client id using pickBy for optimal performance.
* Returns a new object containing only tasks associated with this client.
* @param history - The history object to filter
* @returns Filtered history object containing only tasks from this client
*/
const filterHistoryByClientId = (history: ManagerTaskHistory) =>
pickBy(history, isTaskFromThisClient)
pickBy(history, isHistoryTaskFromThisClient)
/**
* Update task queue and history state with filtered data from server.