Skip to content

Commit

Permalink
Исправляет удаление задачи на странице задачи
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasle committed Dec 30, 2023
1 parent eb54451 commit 2e2460d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/entities/task/model/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ export const $tasksToDelete = createStore<TaskId[]>([])
store.filter((entry) => entry !== taskId),
);

$tasksToDelete.watch((s) => {
console.log(s);
});

export const $tasksList = combine(
$tasks,
$tasksToDelete,
Expand Down Expand Up @@ -107,13 +103,14 @@ const useTasks = () => {
};

const useTask = (id?: TaskId) => {
const unit = useUnit($tasks);
const tasks = useUnit($tasks);
const tasksToDelete = useUnit($tasksToDelete);

if (id === undefined) {
if (id === undefined || tasksToDelete.includes(id)) {
return null;
}

return unit?.[id] ?? null;
return tasks?.[id] ?? null;
};

export const events = {
Expand Down

0 comments on commit 2e2460d

Please sign in to comment.