mirror of
https://github.com/dergigi/boris.git
synced 2025-12-26 19:14:52 +01:00
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.
This commit is contained in:
@@ -33,6 +33,13 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({ 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) => {
|
||||
|
||||
@@ -73,6 +73,7 @@ export const useHighlightCreation = ({
|
||||
console.log('✅ Highlight created successfully!', {
|
||||
id: newHighlight.id,
|
||||
isLocalOnly: newHighlight.isLocalOnly,
|
||||
isOfflineCreated: newHighlight.isOfflineCreated,
|
||||
publishedRelays: newHighlight.publishedRelays
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user