From ca35e4e7cc5ff19bfb7f9bd714843315ec46312e Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 9 Oct 2025 14:05:58 +0100 Subject: [PATCH] fix: plane icon now shows for offline-created highlights - Add useEffect to watch highlight.isOfflineCreated prop changes - State now updates when prop changes (not just on initial mount) - Add isOfflineCreated to console log for easier debugging - Fixes issue where plane icon wouldn't appear for new offline highlights The bug was that showOfflineIndicator state was only set once during component initialization. If the highlight prop didn't have isOfflineCreated set at that moment, the icon would never appear even if the prop changed later. --- src/components/HighlightItem.tsx | 7 +++++++ src/hooks/useHighlightCreation.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/components/HighlightItem.tsx b/src/components/HighlightItem.tsx index 093efb47..e4bce626 100644 --- a/src/components/HighlightItem.tsx +++ b/src/components/HighlightItem.tsx @@ -33,6 +33,13 @@ export const HighlightItem: React.FC = ({ highlight, onSelec return `${highlight.pubkey.slice(0, 8)}...` // fallback to short pubkey } + // Update offline indicator when highlight prop changes + useEffect(() => { + if (highlight.isOfflineCreated && !isSyncing) { + setShowOfflineIndicator(true) + } + }, [highlight.isOfflineCreated, isSyncing]) + // Listen to sync state changes useEffect(() => { const unsubscribe = onSyncStateChange((eventId, syncingState) => { diff --git a/src/hooks/useHighlightCreation.ts b/src/hooks/useHighlightCreation.ts index c468b08b..b93cfde2 100644 --- a/src/hooks/useHighlightCreation.ts +++ b/src/hooks/useHighlightCreation.ts @@ -73,6 +73,7 @@ export const useHighlightCreation = ({ console.log('✅ Highlight created successfully!', { id: newHighlight.id, isLocalOnly: newHighlight.isLocalOnly, + isOfflineCreated: newHighlight.isOfflineCreated, publishedRelays: newHighlight.publishedRelays })