From c40603a36f2a405029619f12e2385be308481c5a Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Fri, 27 Feb 2026 15:05:22 -0800 Subject: [PATCH] Cancellation guard on contact info pane --- frontend/src/components/ContactInfoPane.tsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/ContactInfoPane.tsx b/frontend/src/components/ContactInfoPane.tsx index 08b2f03..9c46294 100644 --- a/frontend/src/components/ContactInfoPane.tsx +++ b/frontend/src/components/ContactInfoPane.tsx @@ -50,15 +50,25 @@ export function ContactInfoPane({ return; } + let cancelled = false; setLoading(true); api .getContactDetail(contactKey) - .then(setDetail) - .catch((err) => { - console.error('Failed to fetch contact detail:', err); - toast.error('Failed to load contact info'); + .then((data) => { + if (!cancelled) setDetail(data); }) - .finally(() => setLoading(false)); + .catch((err) => { + if (!cancelled) { + console.error('Failed to fetch contact detail:', err); + toast.error('Failed to load contact info'); + } + }) + .finally(() => { + if (!cancelled) setLoading(false); + }); + return () => { + cancelled = true; + }; }, [contactKey]); // Use live contact data where available, fall back to detail snapshot