mirror of
https://github.com/dergigi/boris.git
synced 2025-12-19 07:34:28 +01:00
fix: improve offline sync with better tracking and logging
- Track events explicitly when created in offline mode - Mark highlights as offline-created when isLocalOnly is true - Add extensive debug logging throughout sync process - Increase query timeout from 5s to 10s for better reliability - Add 2-second delay before syncing to allow relays to connect - Log relay state transitions and event counts - Log each event received during sync query - Should help diagnose and fix offline sync issues
This commit is contained in:
@@ -48,7 +48,17 @@ export function useOfflineSync({
|
||||
|
||||
if (wasLocalOnly && isNowOnline) {
|
||||
console.log('✈️ Detected transition: Flight Mode → Online')
|
||||
syncLocalEventsToRemote(relayPool, account)
|
||||
console.log('📊 Relay state:', {
|
||||
connectedRelays: connectedRelays.length,
|
||||
remoteRelays: connectedRelays.filter(r => !isLocalRelay(r.url)).length,
|
||||
localRelays: connectedRelays.filter(r => isLocalRelay(r.url)).length
|
||||
})
|
||||
|
||||
// Wait a moment for relays to fully establish connections
|
||||
setTimeout(() => {
|
||||
console.log('🚀 Starting sync after delay...')
|
||||
syncLocalEventsToRemote(relayPool, account)
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
previousStateRef.current.hasRemoteRelays = hasRemoteRelays
|
||||
|
||||
Reference in New Issue
Block a user