fix(tickets): guard linkedTicket fetch with currentChatRef to prevent race condition

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 03:40:31 +00:00
parent 5f5b9e5b23
commit fded959b5e

View File

@@ -247,7 +247,10 @@ export default function AssistantChatPage() {
setActivePsaTicketId(detail.psa_ticket_id)
if (detail.psa_ticket_id) {
integrationsApi.getTicket(detail.psa_ticket_id)
.then(setLinkedTicket)
.then(ticket => {
if (currentChatRef.current !== chatId) return
setLinkedTicket(ticket)
})
.catch(() => {})
} else {
setLinkedTicket(null)