diff --git a/web/app/hooks/actions/use-task-actions.ts b/web/app/hooks/actions/use-task-actions.ts index 4f6d4b25..8410062b 100644 --- a/web/app/hooks/actions/use-task-actions.ts +++ b/web/app/hooks/actions/use-task-actions.ts @@ -2,7 +2,7 @@ import { useCallback } from "react" import { toast } from "sonner" import { LaAccount } from "@/lib/schema" import { ID } from "jazz-tools" -import { ListOfTasks, Task } from "~/lib/schema/task" +import { Task } from "~/lib/schema/task" export const useTaskActions = () => { const newTask = useCallback((me: LaAccount): Task | null => { @@ -12,7 +12,7 @@ export const useTaskActions = () => { } if (!me.root.tasks) { - me.root.tasks = ListOfTasks.create([], { owner: me }) + me.root.tasks = [] } const newTask = Task.create( @@ -33,7 +33,9 @@ export const useTaskActions = () => { const deleteTask = useCallback((me: LaAccount, taskId: ID): void => { if (!me.root?.tasks) return - const index = me.root.tasks.findIndex((item) => item?.id === taskId) + const index: number = me.root.tasks.findIndex( + (item: Task) => item?.id === taskId, + ) if (index === -1) { toast.error("Task not found") return diff --git a/web/app/routes/_layout/_pages/_protected/tasks/-list.tsx b/web/app/routes/_layout/_pages/_protected/tasks/-list.tsx index 6185a7a8..9d8f3b82 100644 --- a/web/app/routes/_layout/_pages/_protected/tasks/-list.tsx +++ b/web/app/routes/_layout/_pages/_protected/tasks/-list.tsx @@ -12,6 +12,14 @@ export const TaskList: React.FC = ({ onUpdateTask, onDeleteTask, }) => { + if (tasks.length === 0) { + return ( +
+

You have no tasks yet

+
+ ) + } + return (