mirror of
https://github.com/dergigi/boris.git
synced 2026-02-11 01:54:22 +01:00
fix: resolve TypeScript type errors in offline sync
- Import IAccount from applesauce-accounts (not applesauce-core) - Remove unused account parameter from syncLocalEventsToRemote - Fix undefined vs null type mismatch in Bookmarks component - All linter and type checks now pass cleanly
This commit is contained in:
@@ -58,7 +58,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
// Automatically sync local events to remote relays when coming back online
|
||||
useOfflineSync({
|
||||
relayPool,
|
||||
account: activeAccount,
|
||||
account: activeAccount || null,
|
||||
eventStore,
|
||||
relayStatuses,
|
||||
enabled: true
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { RelayPool } from 'applesauce-relay'
|
||||
import { IAccount, IEventStore } from 'applesauce-core'
|
||||
import { IAccount } from 'applesauce-accounts'
|
||||
import { IEventStore } from 'applesauce-core'
|
||||
import { syncLocalEventsToRemote } from '../services/offlineSyncService'
|
||||
import { isLocalRelay } from '../utils/helpers'
|
||||
import { RelayStatus } from '../services/relayStatusService'
|
||||
@@ -15,7 +16,7 @@ interface UseOfflineSyncParams {
|
||||
|
||||
export function useOfflineSync({
|
||||
relayPool,
|
||||
account,
|
||||
account: _account,
|
||||
eventStore,
|
||||
relayStatuses,
|
||||
enabled = true
|
||||
@@ -29,7 +30,7 @@ export function useOfflineSync({
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled || !relayPool || !account || !eventStore) return
|
||||
if (!enabled || !relayPool || !_account || !eventStore) return
|
||||
|
||||
const connectedRelays = relayStatuses.filter(r => r.isInPool)
|
||||
const hasRemoteRelays = connectedRelays.some(r => !isLocalRelay(r.url))
|
||||
@@ -59,11 +60,11 @@ export function useOfflineSync({
|
||||
// Wait a moment for relays to fully establish connections
|
||||
setTimeout(() => {
|
||||
console.log('🚀 Starting sync after delay...')
|
||||
syncLocalEventsToRemote(relayPool, account, eventStore)
|
||||
syncLocalEventsToRemote(relayPool, eventStore)
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
previousStateRef.current.hasRemoteRelays = hasRemoteRelays
|
||||
}, [relayPool, account, eventStore, relayStatuses, enabled])
|
||||
}, [relayPool, _account, eventStore, relayStatuses, enabled])
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RelayPool } from 'applesauce-relay'
|
||||
import { NostrEvent } from 'nostr-tools'
|
||||
import { IAccount, IEventStore } from 'applesauce-core'
|
||||
import { IEventStore } from 'applesauce-core'
|
||||
import { RELAYS } from '../config/relays'
|
||||
import { isLocalRelay } from '../utils/helpers'
|
||||
|
||||
@@ -54,7 +54,6 @@ function notifySyncStateChange(eventId: string, isSyncing: boolean): void {
|
||||
*/
|
||||
export async function syncLocalEventsToRemote(
|
||||
relayPool: RelayPool,
|
||||
account: IAccount,
|
||||
eventStore: IEventStore
|
||||
): Promise<void> {
|
||||
if (isSyncing) {
|
||||
|
||||
Reference in New Issue
Block a user