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)
|
||||
// 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 && relayPool) {
|
||||
const updatedHighlight = {
|
||||
@@ -285,9 +283,6 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
onHighlightUpdate(updatedHighlight)
|
||||
}
|
||||
|
||||
// Update local state
|
||||
setShowOfflineIndicator(false)
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Failed to rebroadcast:', error)
|
||||
} finally {
|
||||
|
||||
@@ -315,6 +315,9 @@ export function useArticleLoader({
|
||||
return () => {
|
||||
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,
|
||||
previewData
|
||||
|
||||
@@ -165,6 +165,9 @@ export function useExternalUrlLoader({
|
||||
return () => {
|
||||
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,
|
||||
cachedUrlHighlights
|
||||
|
||||
@@ -7,13 +7,22 @@ import { Helpers, IEventStore } from 'applesauce-core'
|
||||
import { RELAYS } from '../config/relays'
|
||||
import { Highlight } from '../types/highlights'
|
||||
import { UserSettings } from './settingsService'
|
||||
import { isLocalRelay, areAllRelaysLocal } from '../utils/helpers'
|
||||
import { isLocalRelay } from '../utils/helpers'
|
||||
import { setHighlightMetadata } from './highlightEventProcessor'
|
||||
|
||||
// Boris pubkey for zap splits
|
||||
// npub19802see0gnk3vjlus0dnmfdagusqrtmsxpl5yfmkwn9uvnfnqylqduhr0x
|
||||
export const BORIS_PUBKEY = '29dea8672f44ed164bfc83db3da5bd472001af70307f42277674cbc64d33013e'
|
||||
|
||||
// Extended event type with highlight metadata
|
||||
interface HighlightEvent extends NostrEvent {
|
||||
__highlightProps?: {
|
||||
publishedRelays?: string[]
|
||||
isLocalOnly?: boolean
|
||||
isSyncing?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
getHighlightText,
|
||||
getHighlightContext,
|
||||
@@ -119,7 +128,7 @@ export async function createHighlight(
|
||||
const signedEvent = await factory.sign(highlightEvent)
|
||||
|
||||
// Initialize custom properties on the event (will be updated after publishing)
|
||||
;(signedEvent as any).__highlightProps = {
|
||||
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||
publishedRelays: [],
|
||||
isLocalOnly: false,
|
||||
isSyncing: false
|
||||
@@ -170,9 +179,9 @@ export async function createHighlight(
|
||||
connectedRelays: connectedRelays.length,
|
||||
successfulRelays: successfulRelays.length,
|
||||
failedRelays: failedRelays.length,
|
||||
failedRelayDetails: failedRelays,
|
||||
successfulLocalRelays,
|
||||
successfulRemoteRelays,
|
||||
failedRelays,
|
||||
isLocalOnly,
|
||||
flightModeReason: isLocalOnly
|
||||
? '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)
|
||||
;(signedEvent as any).__highlightProps = {
|
||||
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||
publishedRelays: successfulRelaysList,
|
||||
isLocalOnly,
|
||||
isSyncing: false
|
||||
@@ -227,7 +236,7 @@ export async function createHighlight(
|
||||
})
|
||||
|
||||
// Also update the event with the error state (for backwards compatibility)
|
||||
;(signedEvent as any).__highlightProps = {
|
||||
;(signedEvent as HighlightEvent).__highlightProps = {
|
||||
publishedRelays: [],
|
||||
isLocalOnly: true,
|
||||
isSyncing: false
|
||||
|
||||
@@ -2,6 +2,15 @@ import { NostrEvent } from 'nostr-tools'
|
||||
import { Helpers } from 'applesauce-core'
|
||||
import { Highlight } from '../types/highlights'
|
||||
|
||||
// Extended event type with highlight metadata
|
||||
interface HighlightEvent extends NostrEvent {
|
||||
__highlightProps?: {
|
||||
publishedRelays?: string[]
|
||||
isLocalOnly?: boolean
|
||||
isSyncing?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
getHighlightText,
|
||||
getHighlightContext,
|
||||
@@ -67,7 +76,7 @@ export function eventToHighlight(event: NostrEvent): Highlight {
|
||||
const cachedMetadata = getHighlightMetadata(event.id)
|
||||
|
||||
// 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 {
|
||||
id: event.id,
|
||||
|
||||
Reference in New Issue
Block a user