mirror of
https://github.com/dergigi/boris.git
synced 2025-12-27 11:34:50 +01:00
fix(highlights): update relay info after automatic sync completes
When offline sync completes successfully, update the highlight's publishedRelays to show all relays and change icon from plane to server. Previously only manual rebroadcast updated this info.
This commit is contained in:
@@ -60,15 +60,26 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
const unsubscribe = onSyncStateChange((eventId, syncingState) => {
|
||||
if (eventId === highlight.id) {
|
||||
setIsSyncing(syncingState)
|
||||
// Hide offline indicator when sync completes successfully
|
||||
// When sync completes successfully, update highlight to show all relays
|
||||
if (!syncingState) {
|
||||
setShowOfflineIndicator(false)
|
||||
|
||||
// Update the highlight with all relays after successful sync
|
||||
if (onHighlightUpdate && highlight.isLocalOnly) {
|
||||
const updatedHighlight = {
|
||||
...highlight,
|
||||
publishedRelays: RELAYS,
|
||||
isLocalOnly: false,
|
||||
isOfflineCreated: false
|
||||
}
|
||||
onHighlightUpdate(updatedHighlight)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return unsubscribe
|
||||
}, [highlight.id])
|
||||
}, [highlight, onHighlightUpdate])
|
||||
|
||||
useEffect(() => {
|
||||
if (isSelected && itemRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user