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.
This commit is contained in:
Gigi
2025-10-18 21:54:27 +02:00
parent 780996c7c5
commit f8a9079e5f

View File

@@ -139,11 +139,9 @@ const Me: React.FC<MeProps> = ({
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)
}