Skip to content

Commit

Permalink
fixed build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesNg35 committed Oct 13, 2023
1 parent 48a2ee4 commit baa2994
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions apps/web/lib/features/task/task-labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PlusIcon } from 'lib/components/svgs';
import { TaskLabelForm } from 'lib/settings';
import { TaskLabelsDropdown, taskUpdateQueue } from './task-status';
import { debounce, isEqual } from 'lodash';
import { useCallback, useRef } from 'react';
import { useCallback, useMemo, useRef } from 'react';

type Props = {
task: Nullable<ITeamTask>;
Expand All @@ -28,7 +28,7 @@ export function TaskLabels({
const latestLabels = useRef<string[]>([]);

const onValuesChange = useCallback(
debounce((_: any, values: string[] | undefined) => {
(_: any, values: string[] | undefined) => {
if (!$task.current) return;

if (!isEqual(latestLabels.current, values)) {
Expand All @@ -49,18 +49,23 @@ export function TaskLabels({
taskLabels,
values
);
}, 2000),
},
[$task, taskLabels, updateTask, latestLabels]
);

const onValuesChangeDebounce = useMemo(
() => debounce(onValuesChange, 2000),
[onValuesChange]
);

const tags = (task?.tags as typeof taskLabels | undefined)?.map(
(tag) => tag.name || ''
);

return (
<>
<TaskLabelsDropdown
onValueChange={onValueChange ? onValueChange : onValuesChange}
onValueChange={onValueChange ? onValueChange : onValuesChangeDebounce}
className={className}
placeholder="Labels"
defaultValues={tags || []}
Expand Down

0 comments on commit baa2994

Please sign in to comment.