mirror of
https://github.com/dergigi/boris.git
synced 2026-01-08 09:24:42 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user