Browse Source

cleaned up build

imwald
Silberengel 4 months ago
parent
commit
bc424805e3
  1. 2
      package.json
  2. 3
      src/components/Note/index.tsx
  3. 19
      src/components/Profile/ProfileArticles.tsx
  4. 19
      src/components/Profile/ProfileFeed.tsx
  5. 2
      src/constants.ts
  6. 8
      src/hooks/useFetchWebMetadata.tsx
  7. 39
      src/lib/error-suppression.ts
  8. 10
      src/services/client.service.ts
  9. 9
      src/services/local-storage.service.ts
  10. 1
      src/services/note-stats.service.ts

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "jumble-imwald", "name": "jumble-imwald",
"version": "12", "version": "12.1",
"description": "A user-friendly Nostr client focused on relay feed browsing and relay discovery, forked from Jumble", "description": "A user-friendly Nostr client focused on relay feed browsing and relay discovery, forked from Jumble",
"private": true, "private": true,
"type": "module", "type": "module",

3
src/components/Note/index.tsx

@ -75,7 +75,8 @@ export default function Note({
ExtendedKind.GROUP_METADATA, ExtendedKind.GROUP_METADATA,
ExtendedKind.PUBLIC_MESSAGE, ExtendedKind.PUBLIC_MESSAGE,
ExtendedKind.ZAP_REQUEST, ExtendedKind.ZAP_REQUEST,
ExtendedKind.ZAP_RECEIPT ExtendedKind.ZAP_RECEIPT,
ExtendedKind.PUBLICATION_CONTENT // Only for rendering embedded content, not in feeds
] ]

19
src/components/Profile/ProfileArticles.tsx

@ -17,7 +17,6 @@ interface ProfileArticlesProps {
} }
const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event[] }, ProfileArticlesProps>(({ pubkey, topSpace, searchQuery = '', kindFilter = 'all', onEventsChange }, ref) => { const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event[] }, ProfileArticlesProps>(({ pubkey, topSpace, searchQuery = '', kindFilter = 'all', onEventsChange }, ref) => {
console.log('[ProfileArticles] Component rendered with pubkey:', pubkey)
const [events, setEvents] = useState<Event[]>([]) const [events, setEvents] = useState<Event[]>([])
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const [retryCount, setRetryCount] = useState(0) const [retryCount, setRetryCount] = useState(0)
@ -47,14 +46,8 @@ const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event
const uniqueRelays = Array.from(new Set(normalizedRelays)) const uniqueRelays = Array.from(new Set(normalizedRelays))
console.log('[ProfileArticles] Comprehensive relay list:', uniqueRelays.length, 'relays')
console.log('[ProfileArticles] User relays (read):', userRelayList.read?.length || 0)
console.log('[ProfileArticles] User relays (write):', userRelayList.write?.length || 0)
console.log('[ProfileArticles] Favorite relays:', favoriteRelays?.length || 0)
return uniqueRelays return uniqueRelays
} catch (error) { } catch (error) {
console.warn('[ProfileArticles] Error building relay list, using fallback:', error)
return FAST_READ_RELAY_URLS return FAST_READ_RELAY_URLS
} }
}, [pubkey, favoriteRelays]) }, [pubkey, favoriteRelays])
@ -76,11 +69,8 @@ const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event
setIsRefreshing(true) setIsRefreshing(true)
} }
console.log('[ProfileArticles] Fetching events for pubkey:', pubkey, isRetry ? `(retry ${retryCount + 1}/${maxRetries})` : '')
// Build comprehensive relay list including user's personal relays // Build comprehensive relay list including user's personal relays
const comprehensiveRelays = await buildComprehensiveRelayList() const comprehensiveRelays = await buildComprehensiveRelayList()
console.log('[ProfileArticles] Using comprehensive relay list:', comprehensiveRelays.length, 'relays')
// Fetch longform articles (kind 30023), wiki articles (kinds 30817, 30818), publications (kind 30040), and highlights (kind 9802) // Fetch longform articles (kind 30023), wiki articles (kinds 30817, 30818), publications (kind 30040), and highlights (kind 9802)
const allEvents = await client.fetchEvents(comprehensiveRelays, { const allEvents = await client.fetchEvents(comprehensiveRelays, {
@ -89,13 +79,6 @@ const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event
limit: 100 limit: 100
}) })
console.log('[ProfileArticles] Fetched total events:', allEvents.length)
console.log('[ProfileArticles] Sample events:', allEvents.slice(0, 3).map(e => ({ id: e.id, kind: e.kind, content: e.content.substring(0, 50) + '...', tags: e.tags.slice(0, 3) })))
// Show ALL events (longform articles, wiki articles, publications, and highlights)
console.log('[ProfileArticles] Showing all events (articles + publications + highlights):', allEvents.length)
console.log('[ProfileArticles] Events sample:', allEvents.slice(0, 2).map(e => ({ id: e.id, kind: e.kind, content: e.content.substring(0, 50) + '...' })))
const eventsToShow = allEvents const eventsToShow = allEvents
// Sort by creation time (newest first) // Sort by creation time (newest first)
@ -104,7 +87,6 @@ const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event
// If initial load returns 0 events but it's not a retry, wait and retry once // If initial load returns 0 events but it's not a retry, wait and retry once
// This handles cases where relays return "too many concurrent REQS" and return empty results // This handles cases where relays return "too many concurrent REQS" and return empty results
if (!isRetry && !isRefresh && eventsToShow.length === 0 && retryCount === 0) { if (!isRetry && !isRefresh && eventsToShow.length === 0 && retryCount === 0) {
console.log('[ProfileArticles] Got 0 events on initial load, retrying after delay...')
setTimeout(() => { setTimeout(() => {
setRetryCount(prev => prev + 1) setRetryCount(prev => prev + 1)
fetchArticles(true) fetchArticles(true)
@ -136,7 +118,6 @@ const ProfileArticles = forwardRef<{ refresh: () => void; getEvents: () => Event
// If this is not a retry and we haven't exceeded max retries, schedule a retry // If this is not a retry and we haven't exceeded max retries, schedule a retry
if (!isRetry && retryCount < maxRetries) { if (!isRetry && retryCount < maxRetries) {
console.log('[ProfileArticles] Scheduling retry', retryCount + 1, 'of', maxRetries)
// Use shorter delays for initial retries, then exponential backoff // Use shorter delays for initial retries, then exponential backoff
const delay = retryCount === 0 ? 1000 : retryCount === 1 ? 2000 : 3000 const delay = retryCount === 0 ? 1000 : retryCount === 1 ? 2000 : 3000
setTimeout(() => { setTimeout(() => {

19
src/components/Profile/ProfileFeed.tsx

@ -15,7 +15,6 @@ interface ProfileFeedProps {
} }
const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pubkey, topSpace, searchQuery = '' }, ref) => { const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pubkey, topSpace, searchQuery = '' }, ref) => {
console.log('[ProfileFeed] Component rendered with pubkey:', pubkey)
const [events, setEvents] = useState<Event[]>([]) const [events, setEvents] = useState<Event[]>([])
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const [retryCount, setRetryCount] = useState(0) const [retryCount, setRetryCount] = useState(0)
@ -45,14 +44,8 @@ const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pub
const uniqueRelays = Array.from(new Set(normalizedRelays)) const uniqueRelays = Array.from(new Set(normalizedRelays))
console.log('[ProfileFeed] Comprehensive relay list:', uniqueRelays.length, 'relays')
console.log('[ProfileFeed] User relays (read):', userRelayList.read?.length || 0)
console.log('[ProfileFeed] User relays (write):', userRelayList.write?.length || 0)
console.log('[ProfileFeed] Favorite relays:', favoriteRelays?.length || 0)
return uniqueRelays return uniqueRelays
} catch (error) { } catch (error) {
console.warn('[ProfileFeed] Error building relay list, using fallback:', error)
return FAST_READ_RELAY_URLS return FAST_READ_RELAY_URLS
} }
}, [pubkey, favoriteRelays]) }, [pubkey, favoriteRelays])
@ -74,11 +67,8 @@ const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pub
setIsRefreshing(true) setIsRefreshing(true)
} }
console.log('[ProfileFeed] Fetching events for pubkey:', pubkey, isRetry ? `(retry ${retryCount + 1}/${maxRetries})` : '')
// Build comprehensive relay list including user's personal relays // Build comprehensive relay list including user's personal relays
const comprehensiveRelays = await buildComprehensiveRelayList() const comprehensiveRelays = await buildComprehensiveRelayList()
console.log('[ProfileFeed] Using comprehensive relay list:', comprehensiveRelays.length, 'relays')
// Now try to fetch text notes specifically // Now try to fetch text notes specifically
const allEvents = await client.fetchEvents(comprehensiveRelays, { const allEvents = await client.fetchEvents(comprehensiveRelays, {
@ -87,13 +77,6 @@ const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pub
limit: 100 limit: 100
}) })
console.log('[ProfileFeed] Fetched total events:', allEvents.length)
console.log('[ProfileFeed] Sample events:', allEvents.slice(0, 3).map(e => ({ id: e.id, content: e.content.substring(0, 50) + '...', tags: e.tags.slice(0, 3) })))
// Show ALL events (both top-level posts and replies)
console.log('[ProfileFeed] Showing all events (posts + replies):', allEvents.length)
console.log('[ProfileFeed] Events sample:', allEvents.slice(0, 2).map(e => ({ id: e.id, content: e.content.substring(0, 50) + '...' })))
const eventsToShow = allEvents const eventsToShow = allEvents
// Sort by creation time (newest first) // Sort by creation time (newest first)
@ -102,7 +85,6 @@ const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pub
// If initial load returns 0 events but it's not a retry, wait and retry once // If initial load returns 0 events but it's not a retry, wait and retry once
// This handles cases where relays return "too many concurrent REQS" and return empty results // This handles cases where relays return "too many concurrent REQS" and return empty results
if (!isRetry && !isRefresh && eventsToShow.length === 0 && retryCount === 0) { if (!isRetry && !isRefresh && eventsToShow.length === 0 && retryCount === 0) {
console.log('[ProfileFeed] Got 0 events on initial load, retrying after delay...')
setTimeout(() => { setTimeout(() => {
setRetryCount(prev => prev + 1) setRetryCount(prev => prev + 1)
fetchPosts(true) fetchPosts(true)
@ -134,7 +116,6 @@ const ProfileFeed = forwardRef<{ refresh: () => void }, ProfileFeedProps>(({ pub
// If this is not a retry and we haven't exceeded max retries, schedule a retry // If this is not a retry and we haven't exceeded max retries, schedule a retry
if (!isRetry && retryCount < maxRetries) { if (!isRetry && retryCount < maxRetries) {
console.log('[ProfileFeed] Scheduling retry', retryCount + 1, 'of', maxRetries)
// Use shorter delays for initial retries, then exponential backoff // Use shorter delays for initial retries, then exponential backoff
const delay = retryCount === 0 ? 1000 : retryCount === 1 ? 2000 : 3000 const delay = retryCount === 0 ? 1000 : retryCount === 1 ? 2000 : 3000
setTimeout(() => { setTimeout(() => {

2
src/constants.ts

@ -173,7 +173,7 @@ export const SUPPORTED_KINDS = [
ExtendedKind.PUBLICATION, ExtendedKind.PUBLICATION,
ExtendedKind.WIKI_ARTICLE, ExtendedKind.WIKI_ARTICLE,
ExtendedKind.WIKI_ARTICLE_MARKDOWN, ExtendedKind.WIKI_ARTICLE_MARKDOWN,
ExtendedKind.PUBLICATION_CONTENT, // ExtendedKind.PUBLICATION_CONTENT, // Excluded - publication content should only be embedded in publications
// NIP-89 Application Handlers // NIP-89 Application Handlers
ExtendedKind.APPLICATION_HANDLER_RECOMMENDATION, ExtendedKind.APPLICATION_HANDLER_RECOMMENDATION,
ExtendedKind.APPLICATION_HANDLER_INFO ExtendedKind.APPLICATION_HANDLER_INFO

8
src/hooks/useFetchWebMetadata.tsx

@ -7,20 +7,16 @@ export function useFetchWebMetadata(url: string) {
useEffect(() => { useEffect(() => {
if (!url) { if (!url) {
console.log('[useFetchWebMetadata] No URL provided')
return return
} }
console.log(`[useFetchWebMetadata] Fetching metadata for URL: ${url}`)
// Pass original URL - web service will handle proxy conversion // Pass original URL - web service will handle proxy conversion
webService.fetchWebMetadata(url) webService.fetchWebMetadata(url)
.then((metadata) => { .then((metadata) => {
console.log(`[useFetchWebMetadata] Received metadata for ${url}:`, metadata)
setMetadata(metadata) setMetadata(metadata)
}) })
.catch((error) => { .catch(() => {
console.error(`[useFetchWebMetadata] Error fetching metadata for ${url}:`, error) // Silent fail
}) })
}, [url]) }, [url])

39
src/lib/error-suppression.ts

@ -94,6 +94,16 @@ export function suppressExpectedErrors() {
return return
} }
// Suppress WebSocket connection errors
if (message.includes('WebSocket connection to') || message.includes('failed:') || message.includes('Close received after close')) {
return
}
// Suppress Ping timeout errors
if (message.includes('Ping timeout')) {
return
}
// Call original console.error for unexpected errors // Call original console.error for unexpected errors
originalConsoleError.apply(console, args) originalConsoleError.apply(console, args)
} }
@ -112,9 +122,38 @@ export function suppressExpectedErrors() {
suppressedErrors.add('react-devtools') suppressedErrors.add('react-devtools')
} }
// Suppress Workbox warnings
if (message.includes('workbox') && (
message.includes('will not be cached') ||
message.includes('Network request for') ||
message.includes('returned a response with status')
)) {
return
}
// Call original console.warn for unexpected warnings // Call original console.warn for unexpected warnings
originalConsoleWarn.apply(console, args) originalConsoleWarn.apply(console, args)
} }
// Override console.log to filter out expected logs
const originalConsoleLog = console.log
console.log = (...args: any[]) => {
const message = args.join(' ')
// Suppress Workbox logs
if (message.includes('workbox') || message.includes('[NoteStats]')) {
return
}
// Suppress nostr-tools notices (ping, etc.)
if (message.includes('NOTICE from')) {
return
}
// Call original console.log for unexpected logs
originalConsoleLog.apply(console, args)
}
} }
// Initialize error suppression // Initialize error suppression

10
src/services/client.service.ts

@ -553,8 +553,8 @@ class ClientService extends EventTarget {
.then((sub) => { .then((sub) => {
sub.close() sub.close()
}) })
.catch((err) => { .catch(() => {
console.error(err) // Silent fail
}) })
}) })
} }
@ -895,7 +895,6 @@ class ClientService extends EventTarget {
this.trendingNotesCache = events this.trendingNotesCache = events
return this.trendingNotesCache return this.trendingNotesCache
} catch (error) { } catch (error) {
console.error('fetchTrendingNotes error', error)
return [] return []
} }
} }
@ -1020,7 +1019,6 @@ class ClientService extends EventTarget {
return relays return relays
} catch (error) { } catch (error) {
console.warn('[ClientService] Error fetching user favorite relays:', error)
return [] return []
} }
} }
@ -1058,7 +1056,7 @@ class ClientService extends EventTarget {
}) })
} }
} catch (error) { } catch (error) {
console.warn('[ClientService] Error fetching user relay list:', error) // Silent fail
} }
} }
@ -1473,7 +1471,7 @@ class ClientService extends EventTarget {
} }
}) })
} catch (error) { } catch (error) {
console.warn('[ClientService] Error fetching cache relay events:', error) // Silent fail
} }
} }

9
src/services/local-storage.service.ts

@ -211,10 +211,17 @@ class LocalStorageService {
showKinds.push(ExtendedKind.WIKI_ARTICLE) showKinds.push(ExtendedKind.WIKI_ARTICLE)
} }
} }
if (showKindsVersion < 5) {
// Remove publication content from existing users' filters (should only be embedded)
const pubContentIndex = showKinds.indexOf(ExtendedKind.PUBLICATION_CONTENT)
if (pubContentIndex !== -1) {
showKinds.splice(pubContentIndex, 1)
}
}
this.showKinds = showKinds this.showKinds = showKinds
} }
window.localStorage.setItem(StorageKey.SHOW_KINDS, JSON.stringify(this.showKinds)) window.localStorage.setItem(StorageKey.SHOW_KINDS, JSON.stringify(this.showKinds))
window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '4') window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '5')
this.hideContentMentioningMutedUsers = this.hideContentMentioningMutedUsers =
window.localStorage.getItem(StorageKey.HIDE_CONTENT_MENTIONING_MUTED_USERS) === 'true' window.localStorage.getItem(StorageKey.HIDE_CONTENT_MENTIONING_MUTED_USERS) === 'true'

1
src/services/note-stats.service.ts

@ -86,7 +86,6 @@ class NoteStatsService {
this.batchTimeout = null this.batchTimeout = null
} }
console.log('[NoteStats] Processing batch of', eventsToProcess.length, 'events')
// Process all events in the batch // Process all events in the batch
await Promise.all(eventsToProcess.map(eventId => this.processSingleEvent(eventId))) await Promise.all(eventsToProcess.map(eventId => this.processSingleEvent(eventId)))

Loading…
Cancel
Save