refactor: enhance delete run logic with locking mechanism and update sidebar button visibility

This commit is contained in:
tusharmagar 2026-02-16 15:45:58 +05:30
parent 5f3b0a3174
commit 6b0f31c369
2 changed files with 25 additions and 14 deletions

View file

@ -1056,21 +1056,23 @@ function TasksSection({
) : null}
<span className="min-w-0 flex-1 truncate text-sm">{run.title || '(Untitled chat)'}</span>
{run.createdAt ? (
<span className="shrink-0 text-[10px] text-muted-foreground group-hover/chat-item:hidden">
<span className={`shrink-0 text-[10px] text-muted-foreground${processingRunIds?.has(run.id) ? '' : ' group-hover/chat-item:hidden'}`}>
{formatRunTime(run.createdAt)}
</span>
) : null}
<button
type="button"
className="shrink-0 hidden group-hover/chat-item:flex items-center justify-center text-muted-foreground hover:text-destructive transition-colors"
onClick={(e) => {
e.stopPropagation()
actions?.onDeleteRun(run.id)
}}
aria-label="Delete chat"
>
<Trash2 className="size-3.5" />
</button>
{!processingRunIds?.has(run.id) && (
<button
type="button"
className="shrink-0 hidden group-hover/chat-item:flex items-center justify-center text-muted-foreground hover:text-destructive transition-colors"
onClick={(e) => {
e.stopPropagation()
actions?.onDeleteRun(run.id)
}}
aria-label="Delete chat"
>
<Trash2 className="size-3.5" />
</button>
)}
</div>
</SidebarMenuButton>
</SidebarMenuItem>