From 159df1ec5b5b403f2a282b2f7d7af3df937fda86 Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Wed, 8 Apr 2026 16:33:44 -0700 Subject: [PATCH] Revert "Add debug lines for fav click" This reverts commit 8e2e039985bd32b105b97a5a437db2ddf2c6cdbd. --- frontend/src/App.tsx | 32 +++++-------------- frontend/src/components/ChannelInfoPane.tsx | 7 +--- frontend/src/components/ChatHeader.tsx | 9 ++---- frontend/src/components/ContactInfoPane.tsx | 7 +--- frontend/src/components/RepeaterDashboard.tsx | 7 +--- frontend/src/utils/contactMerge.ts | 11 +------ 6 files changed, 15 insertions(+), 58 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c1de3cf..c6a2ab9 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -207,36 +207,20 @@ export function App() { const handleToggleFavorite = useCallback( async (type: 'channel' | 'contact', id: string) => { - const ts = performance.now().toFixed(2); - console.log( - `[fav-debug] handleToggleFavorite called t=${ts} type=${type} id=${id.slice(0, 12)}` - ); - // Optimistically toggle the favorite flag if (type === 'contact') { - setContacts((prev) => { - const match = prev.find((c) => c.public_key === id); - console.log( - `[fav-debug] optimistic contact toggle t=${ts} current=${match?.favorite} → ${!match?.favorite}` - ); - return prev.map((c) => (c.public_key === id ? { ...c, favorite: !c.favorite } : c)); - }); + setContacts((prev) => + prev.map((c) => (c.public_key === id ? { ...c, favorite: !c.favorite } : c)) + ); } else { - setChannels((prev) => { - const match = prev.find((c) => c.key === id); - console.log( - `[fav-debug] optimistic channel toggle t=${ts} current=${match?.favorite} → ${!match?.favorite}` - ); - return prev.map((c) => (c.key === id ? { ...c, favorite: !c.favorite } : c)); - }); + setChannels((prev) => + prev.map((c) => (c.key === id ? { ...c, favorite: !c.favorite } : c)) + ); } try { - console.log(`[fav-debug] firing API request t=${ts}`); - const result = await api.toggleFavorite(type, id); - console.log(`[fav-debug] API response t=${ts}`, result); - } catch (err) { - console.error(`[fav-debug] API error t=${ts}`, err); + await api.toggleFavorite(type, id); + } catch { // Revert on failure if (type === 'contact') { setContacts((prev) => diff --git a/frontend/src/components/ChannelInfoPane.tsx b/frontend/src/components/ChannelInfoPane.tsx index 07c2d11..8c63da6 100644 --- a/frontend/src/components/ChannelInfoPane.tsx +++ b/frontend/src/components/ChannelInfoPane.tsx @@ -120,12 +120,7 @@ export function ChannelInfoPane({