From 0b703201f397e75dd96dc3b2b65947824966574c Mon Sep 17 00:00:00 2001 From: Sergej Date: Thu, 20 Feb 2025 14:44:37 +0100 Subject: [PATCH] Warn when ParaId not found in registrar --- src/components/Regions/Modals/AddTask/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Regions/Modals/AddTask/index.tsx b/src/components/Regions/Modals/AddTask/index.tsx index 3e1638e0..5bcee58d 100644 --- a/src/components/Regions/Modals/AddTask/index.tsx +++ b/src/components/Regions/Modals/AddTask/index.tsx @@ -27,7 +27,7 @@ export const AddTaskModal = ({ onClose, ...props }: AddTaskModalProps) => { const theme = useTheme(); const { paraIds } = useRelayApi(); - const { toastError } = useToast(); + const { toastError, toastWarning } = useToast(); const { tasks, addTask } = useTasks(); const [taskId, setTaskId] = useState(); @@ -45,12 +45,12 @@ export const AddTaskModal = ({ onClose, ...props }: AddTaskModalProps) => { const existing = tasks.find((task) => task.id === taskId); if (existing) { toastError('Failed to add task. Duplicated ID'); - } else if (!paraIds.includes(taskId)) { - toastError(`Para ID ${taskId} doesn't exist.`); } else { + if (!paraIds.includes(taskId)) toastWarning(`Para ID ${taskId} not found in the registrar.`); addTask({ id: taskId, usage: 0, name: taskName } as TaskMetadata); setTaskId(undefined); setTaskName(''); + onClose(); } };