fix: prioritize isLocalOnly check to show airplane icon

- Check isLocalOnly first before checking publishedRelays length
- Show airplane icon if isLocalOnly is true, even if publishedRelays is empty
- This ensures flight mode highlights show airplane icon via offline sync fallback
- Add debug logs to track cache storage and retrieval
- Fixes issue where airplane icon doesn't show when creating highlights offline
This commit is contained in:
Gigi
2025-10-31 00:09:09 +01:00
parent d6da27c634
commit 29eed3395f
2 changed files with 32 additions and 2 deletions

View File

@@ -327,18 +327,34 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
highlightId: highlight.id,
isLocalOnly,
publishedRelays,
highlightPublishedRelays: highlight.publishedRelays,
highlightIsLocalOnly: highlight.isLocalOnly,
willShowAirplane: isLocalOnly === true
})
}
// If isLocalOnly is true (from any fallback), show airplane icon
if (isLocalOnly === true) {
const relayNames = publishedRelays.length > 0
? publishedRelays.map(url => url.replace(/^wss?:\/\//, '').replace(/\/$/, ''))
: []
return {
icon: faPlane,
tooltip: publishedRelays.length > 0
? 'Local relays only - will sync when remote relays available'
: 'Created in flight mode - will sync when remote relays available',
spin: false
}
}
// Show highlighter icon with relay info if available
if (highlight.publishedRelays && highlight.publishedRelays.length > 0) {
const relayNames = highlight.publishedRelays.map(url =>
url.replace(/^wss?:\/\//, '').replace(/\/$/, '')
)
return {
icon: isLocalOnly ? faPlane : faHighlighter,
tooltip: isLocalOnly ? 'Local relays only - will sync when remote relays available' : relayNames.join('\n'),
icon: faHighlighter,
tooltip: relayNames.join('\n'),
spin: false
}
}

View File

@@ -43,6 +43,10 @@ export function setHighlightMetadata(
}
): void {
highlightMetadataCache.set(eventId, metadata)
console.log('💾 [HIGHLIGHT-METADATA] Stored metadata in cache:', {
eventId,
metadata
})
}
/**
@@ -78,6 +82,16 @@ export function eventToHighlight(event: NostrEvent): Highlight {
// Fall back to __highlightProps if cache doesn't have it (for backwards compatibility)
const customProps = cachedMetadata || (event as HighlightEvent).__highlightProps || {}
// Debug: Log cache lookup for recently created highlights
if (event.id && (cachedMetadata || (event as HighlightEvent).__highlightProps)) {
console.log('🔍 [EVENT-TO-HIGHLIGHT] Cache lookup:', {
eventId: event.id,
foundInCache: !!cachedMetadata,
hasHighlightProps: !!(event as HighlightEvent).__highlightProps,
customProps
})
}
return {
id: event.id,
pubkey: event.pubkey,