Shun Miyazawa 1 год назад
Родитель
Сommit
d072d2eed0

+ 10 - 4
apps/app/src/features/openai/client/components/AiAssistant/Sidebar/AiAssistantTree.tsx

@@ -32,9 +32,9 @@ const ThreadItem: React.FC<ThreadItemProps> = ({
   thread, aiAssistantData, onThreadClick, onThreadDelete,
   thread, aiAssistantData, onThreadClick, onThreadDelete,
 }) => {
 }) => {
 
 
-  const deleteThreadHandler = useCallback(() => {
+  const deleteThreadHandler = useCallback(async() => {
     try {
     try {
-      deleteThread(aiAssistantData._id, thread._id);
+      await deleteThread(aiAssistantData._id, thread._id);
       toastSuccess('スレッドを削除しました');
       toastSuccess('スレッドを削除しました');
       onThreadDelete();
       onThreadDelete();
     }
     }
@@ -51,7 +51,10 @@ const ThreadItem: React.FC<ThreadItemProps> = ({
     <li
     <li
       role="button"
       role="button"
       className="list-group-item list-group-item-action border-0 d-flex align-items-center rounded-1 ps-5"
       className="list-group-item list-group-item-action border-0 d-flex align-items-center rounded-1 ps-5"
-      onClick={openChatHandler}
+      onClick={(e) => {
+        e.stopPropagation();
+        openChatHandler();
+      }}
     >
     >
       <div>
       <div>
         <span className="material-symbols-outlined fs-5">chat</span>
         <span className="material-symbols-outlined fs-5">chat</span>
@@ -65,7 +68,10 @@ const ThreadItem: React.FC<ThreadItemProps> = ({
         <button
         <button
           type="button"
           type="button"
           className="btn btn-link text-secondary p-0"
           className="btn btn-link text-secondary p-0"
-          onClick={deleteThreadHandler}
+          onClick={(e) => {
+            e.stopPropagation();
+            deleteThreadHandler();
+          }}
         >
         >
           <span className="material-symbols-outlined fs-5">delete</span>
           <span className="material-symbols-outlined fs-5">delete</span>
         </button>
         </button>