Skip to content

Commit e1ce36f

Browse files
committed
fix(tasks): resolve comments
1 parent f507b76 commit e1ce36f

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

apps/web/src/app/[locale]/(dashboard)/[wsId]/tasks/boards/[boardId]/_components/list-view.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,12 @@ export function ListView({
255255
return updateObj;
256256
});
257257

258-
if (updates.some((obj) => Object.keys(obj).length > 1)) {
258+
// Check if any updates have meaningful changes (more than just the id field)
259+
const hasUpdates = updates.some((obj) =>
260+
obj.priority !== undefined || obj.archived !== undefined || obj.tags !== undefined
261+
);
262+
263+
if (hasUpdates) {
259264
// Only call RPC if at least one field is being updated
260265
const { error } = await supabase.rpc('update_many_tasks', { updates });
261266
if (error) throw error;

apps/web/src/app/[locale]/(dashboard)/[wsId]/tasks/boards/[boardId]/kanban.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,23 @@ export function KanbanBoard({ boardId, tasks, isLoading }: Props) {
140140
const task = active.data.current.task;
141141
setActiveTask(task);
142142
pickedUpTaskColumn.current = String(task.list_id);
143-
// Get the DOM node of the dragged card
144-
const cardNode = document.querySelector(`[data-id="${task.id}"]`);
143+
144+
// Use more specific selector for better reliability
145+
// Prefer data-id selector over generic querySelector
146+
const cardNode = document.querySelector(`[data-id="${task.id}"]`) as HTMLElement;
145147
if (cardNode) {
146148
const cardRect = cardNode.getBoundingClientRect();
147149
dragStartCardLeft.current = cardRect.left;
150+
} else {
151+
// Fallback: try to find the card by task ID in a more specific way
152+
const taskCards = document.querySelectorAll('[data-id]');
153+
const targetCard = Array.from(taskCards).find(
154+
(card) => card.getAttribute('data-id') === task.id
155+
) as HTMLElement;
156+
if (targetCard) {
157+
const cardRect = targetCard.getBoundingClientRect();
158+
dragStartCardLeft.current = cardRect.left;
159+
}
148160
}
149161
return;
150162
}

apps/web/src/app/[locale]/(dashboard)/[wsId]/tasks/boards/[boardId]/task-list.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ export const BoardColumn = React.memo(function BoardColumn({
740740
if (!filters.assignees.has('all')) {
741741
newAssignees.add('all');
742742
}
743+
// Ensure mutual exclusivity with 'unassigned'
743744
setFilters((prev) => ({
744745
...prev,
745746
assignees: newAssignees,
@@ -764,6 +765,7 @@ export const BoardColumn = React.memo(function BoardColumn({
764765
if (!filters.assignees.has('unassigned')) {
765766
newAssignees.add('unassigned');
766767
}
768+
// Ensure mutual exclusivity with 'all'
767769
setFilters((prev) => ({
768770
...prev,
769771
assignees: newAssignees,
@@ -795,8 +797,9 @@ export const BoardColumn = React.memo(function BoardColumn({
795797
onSelect={() => {
796798
const newAssignees = new Set(filters.assignees);
797799
if (filters.assignees.has('all') || filters.assignees.has('unassigned')) {
798-
// If 'all' or 'unassigned' is selected, start fresh
799-
newAssignees.clear();
800+
// If 'all' or 'unassigned' is selected, clear them to avoid conflicts
801+
newAssignees.delete('all');
802+
newAssignees.delete('unassigned');
800803
}
801804
if (isSelected) {
802805
newAssignees.delete(member.id);

0 commit comments

Comments
 (0)