From 7c88dbc9691e2ba2c8f8f68d516a22c97f22c152 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 1 Sep 2025 14:27:59 -0700 Subject: [PATCH] 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 --- src/composables/useManagerQueue.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/composables/useManagerQueue.ts b/src/composables/useManagerQueue.ts index b1ba3f53a..a02abae40 100644 --- a/src/composables/useManagerQueue.ts +++ b/src/composables/useManagerQueue.ts @@ -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.