diff --git a/src/components/HighlightItem.tsx b/src/components/HighlightItem.tsx index 7589fb13..0650be32 100644 --- a/src/components/HighlightItem.tsx +++ b/src/components/HighlightItem.tsx @@ -310,14 +310,16 @@ export const HighlightItem: React.FC = ({ const isLocalOnly = highlight.isLocalOnly const publishedRelays = highlight.publishedRelays || [] - console.log('🎯 [HIGHLIGHT-UI] Rendering highlight relay indicator:', { - highlightId: highlight.id, - isLocalOnly: isLocalOnly, - publishedRelays: publishedRelays, - publishedRelayCount: publishedRelays.length, - willShowAirplaneIcon: isLocalOnly, - highlightObject: highlight // Log the entire highlight object to see what's actually there - }) + // Only log when values are meaningful (not undefined/empty) to reduce spam + if (isLocalOnly !== undefined || publishedRelays.length > 0) { + console.log('🎯 [HIGHLIGHT-UI] Rendering highlight relay indicator:', { + highlightId: highlight.id, + isLocalOnly: isLocalOnly, + publishedRelays: publishedRelays, + publishedRelayCount: publishedRelays.length, + willShowAirplaneIcon: isLocalOnly + }) + } // Show highlighter icon with relay info if available if (highlight.publishedRelays && highlight.publishedRelays.length > 0) { diff --git a/src/services/highlightCreationService.ts b/src/services/highlightCreationService.ts index 41bfdddd..fd9e13b9 100644 --- a/src/services/highlightCreationService.ts +++ b/src/services/highlightCreationService.ts @@ -117,16 +117,13 @@ export async function createHighlight( // Sign the event const signedEvent = await factory.sign(highlightEvent) - // Attach custom properties to the event for later retrieval + // Initialize custom properties on the event (will be updated after publishing) ;(signedEvent as any).__highlightProps = { publishedRelays: [], isLocalOnly: false, isSyncing: false } - // Store the event in EventStore first for immediate UI display - eventStore.add(signedEvent) - // Publish to all relays and get individual responses const allRelays = RELAYS let publishResponses: { ok: boolean; message?: string; from: string }[] = [] @@ -184,6 +181,9 @@ export async function createHighlight( isSyncing: false } + // Store the event in EventStore AFTER updating with final properties + eventStore.add(signedEvent) + // Mark for offline sync if we're in local-only mode if (isLocalOnly) { console.log('✈️ [HIGHLIGHT-PUBLISH] Marking event for offline sync (flight mode)') @@ -205,6 +205,9 @@ export async function createHighlight( isSyncing: false } + // Store the event in EventStore AFTER updating with final properties + eventStore.add(signedEvent) + console.log('✈️ [HIGHLIGHT-PUBLISH] Publishing failed, marking for offline sync (flight mode)') const { markEventAsOfflineCreated } = await import('./offlineSyncService') markEventAsOfflineCreated(signedEvent.id)