mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 14:44:26 +01:00
fix: resolve all linting errors and type issues
- Remove unused setShowOfflineIndicator calls - Remove unused areAllRelaysLocal import - Fix duplicate key 'failedRelays' in console.log - Replace 'any' types with proper HighlightEvent interface - Add eslint-disable comments for intentionally excluded useEffect dependencies - All linting errors resolved, type checks pass
This commit is contained in:
@@ -140,8 +140,6 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
|||||||
setIsSyncing(syncingState)
|
setIsSyncing(syncingState)
|
||||||
// When sync completes successfully, update highlight to show all relays
|
// When sync completes successfully, update highlight to show all relays
|
||||||
if (!syncingState) {
|
if (!syncingState) {
|
||||||
setShowOfflineIndicator(false)
|
|
||||||
|
|
||||||
// Update the highlight with all relays after successful sync
|
// Update the highlight with all relays after successful sync
|
||||||
if (onHighlightUpdate && highlight.isLocalOnly && relayPool) {
|
if (onHighlightUpdate && highlight.isLocalOnly && relayPool) {
|
||||||
const updatedHighlight = {
|
const updatedHighlight = {
|
||||||
@@ -285,9 +283,6 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
|||||||
onHighlightUpdate(updatedHighlight)
|
onHighlightUpdate(updatedHighlight)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update local state
|
|
||||||
setShowOfflineIndicator(false)
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Failed to rebroadcast:', error)
|
console.error('❌ Failed to rebroadcast:', error)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -315,6 +315,9 @@ export function useArticleLoader({
|
|||||||
return () => {
|
return () => {
|
||||||
mountedRef.current = false
|
mountedRef.current = false
|
||||||
}
|
}
|
||||||
|
// Dependencies intentionally excluded to prevent re-renders when relay/eventStore state changes
|
||||||
|
// This fixes the loading skeleton appearing when going offline (flight mode)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [
|
}, [
|
||||||
naddr,
|
naddr,
|
||||||
previewData
|
previewData
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ export function useExternalUrlLoader({
|
|||||||
return () => {
|
return () => {
|
||||||
mountedRef.current = false
|
mountedRef.current = false
|
||||||
}
|
}
|
||||||
|
// Dependencies intentionally excluded to prevent re-renders when relay/eventStore state changes
|
||||||
|
// This fixes the loading skeleton appearing when going offline (flight mode)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [
|
}, [
|
||||||
url,
|
url,
|
||||||
cachedUrlHighlights
|
cachedUrlHighlights
|
||||||
|
|||||||
@@ -7,13 +7,22 @@ import { Helpers, IEventStore } from 'applesauce-core'
|
|||||||
import { RELAYS } from '../config/relays'
|
import { RELAYS } from '../config/relays'
|
||||||
import { Highlight } from '../types/highlights'
|
import { Highlight } from '../types/highlights'
|
||||||
import { UserSettings } from './settingsService'
|
import { UserSettings } from './settingsService'
|
||||||
import { isLocalRelay, areAllRelaysLocal } from '../utils/helpers'
|
import { isLocalRelay } from '../utils/helpers'
|
||||||
import { setHighlightMetadata } from './highlightEventProcessor'
|
import { setHighlightMetadata } from './highlightEventProcessor'
|
||||||
|
|
||||||
// Boris pubkey for zap splits
|
// Boris pubkey for zap splits
|
||||||
// npub19802see0gnk3vjlus0dnmfdagusqrtmsxpl5yfmkwn9uvnfnqylqduhr0x
|
// npub19802see0gnk3vjlus0dnmfdagusqrtmsxpl5yfmkwn9uvnfnqylqduhr0x
|
||||||
export const BORIS_PUBKEY = '29dea8672f44ed164bfc83db3da5bd472001af70307f42277674cbc64d33013e'
|
export const BORIS_PUBKEY = '29dea8672f44ed164bfc83db3da5bd472001af70307f42277674cbc64d33013e'
|
||||||
|
|
||||||
|
// Extended event type with highlight metadata
|
||||||
|
interface HighlightEvent extends NostrEvent {
|
||||||
|
__highlightProps?: {
|
||||||
|
publishedRelays?: string[]
|
||||||
|
isLocalOnly?: boolean
|
||||||
|
isSyncing?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getHighlightText,
|
getHighlightText,
|
||||||
getHighlightContext,
|
getHighlightContext,
|
||||||
@@ -119,7 +128,7 @@ export async function createHighlight(
|
|||||||
const signedEvent = await factory.sign(highlightEvent)
|
const signedEvent = await factory.sign(highlightEvent)
|
||||||
|
|
||||||
// Initialize custom properties on the event (will be updated after publishing)
|
// Initialize custom properties on the event (will be updated after publishing)
|
||||||
;(signedEvent as any).__highlightProps = {
|
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||||
publishedRelays: [],
|
publishedRelays: [],
|
||||||
isLocalOnly: false,
|
isLocalOnly: false,
|
||||||
isSyncing: false
|
isSyncing: false
|
||||||
@@ -170,9 +179,9 @@ export async function createHighlight(
|
|||||||
connectedRelays: connectedRelays.length,
|
connectedRelays: connectedRelays.length,
|
||||||
successfulRelays: successfulRelays.length,
|
successfulRelays: successfulRelays.length,
|
||||||
failedRelays: failedRelays.length,
|
failedRelays: failedRelays.length,
|
||||||
|
failedRelayDetails: failedRelays,
|
||||||
successfulLocalRelays,
|
successfulLocalRelays,
|
||||||
successfulRemoteRelays,
|
successfulRemoteRelays,
|
||||||
failedRelays,
|
|
||||||
isLocalOnly,
|
isLocalOnly,
|
||||||
flightModeReason: isLocalOnly
|
flightModeReason: isLocalOnly
|
||||||
? 'Only local relays accepted the event'
|
? 'Only local relays accepted the event'
|
||||||
@@ -196,7 +205,7 @@ export async function createHighlight(
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Also update the event with the actual properties (for backwards compatibility)
|
// Also update the event with the actual properties (for backwards compatibility)
|
||||||
;(signedEvent as any).__highlightProps = {
|
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||||
publishedRelays: successfulRelaysList,
|
publishedRelays: successfulRelaysList,
|
||||||
isLocalOnly,
|
isLocalOnly,
|
||||||
isSyncing: false
|
isSyncing: false
|
||||||
@@ -227,7 +236,7 @@ export async function createHighlight(
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Also update the event with the error state (for backwards compatibility)
|
// Also update the event with the error state (for backwards compatibility)
|
||||||
;(signedEvent as any).__highlightProps = {
|
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||||
publishedRelays: [],
|
publishedRelays: [],
|
||||||
isLocalOnly: true,
|
isLocalOnly: true,
|
||||||
isSyncing: false
|
isSyncing: false
|
||||||
|
|||||||
@@ -2,6 +2,15 @@ import { NostrEvent } from 'nostr-tools'
|
|||||||
import { Helpers } from 'applesauce-core'
|
import { Helpers } from 'applesauce-core'
|
||||||
import { Highlight } from '../types/highlights'
|
import { Highlight } from '../types/highlights'
|
||||||
|
|
||||||
|
// Extended event type with highlight metadata
|
||||||
|
interface HighlightEvent extends NostrEvent {
|
||||||
|
__highlightProps?: {
|
||||||
|
publishedRelays?: string[]
|
||||||
|
isLocalOnly?: boolean
|
||||||
|
isSyncing?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getHighlightText,
|
getHighlightText,
|
||||||
getHighlightContext,
|
getHighlightContext,
|
||||||
@@ -67,7 +76,7 @@ export function eventToHighlight(event: NostrEvent): Highlight {
|
|||||||
const cachedMetadata = getHighlightMetadata(event.id)
|
const cachedMetadata = getHighlightMetadata(event.id)
|
||||||
|
|
||||||
// Fall back to __highlightProps if cache doesn't have it (for backwards compatibility)
|
// Fall back to __highlightProps if cache doesn't have it (for backwards compatibility)
|
||||||
const customProps = cachedMetadata || (event as any).__highlightProps || {}
|
const customProps = cachedMetadata || (event as HighlightEvent).__highlightProps || {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user