From f8a9079e5ffad12fb15f214039d5c30cdfdd0c28 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sat, 18 Oct 2025 21:54:27 +0200 Subject: [PATCH] fix: don't manually set highlights in loadHighlightsTab for own profile The real issue: loadHighlightsTab was calling setHighlights(myHighlights) before the controller subscription had populated myHighlights, resulting in setting highlights to an empty array. Solution: For own profile, let the sync effect handle setting highlights. The controller subscription + sync effect is the single source of truth. Only fetch highlights manually when viewing other users' profiles. Flow for own profile: 1. Controller subscription populates myHighlights 2. Sync effect (useEffect) updates local highlights state 3. No manual setting needed in loadHighlightsTab This ensures highlights are always synced from the controller, never from a stale/empty initial value. --- src/components/Me.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/Me.tsx b/src/components/Me.tsx index 13a18d89..aec4e724 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -139,11 +139,9 @@ const Me: React.FC = ({ try { if (!hasBeenLoaded) setLoading(true) - // For own profile, use myHighlights from controller (already loaded on app start) - if (isOwnProfile) { - setHighlights(myHighlights) - } else { - // For viewing other users, fetch on-demand + // For own profile, highlights come from controller subscription (sync effect handles it) + // For viewing other users, fetch on-demand + if (!isOwnProfile) { const userHighlights = await fetchHighlights(relayPool, viewingPubkey) setHighlights(userHighlights) }