mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 22:54:30 +01:00
fix: make event loading non-blocking and wait for relay pool
- Don't show error if relayPool isn't available yet - Instead, keep loading state and wait for relayPool to become available - Effect will re-run automatically when relayPool is set - Enables smooth loading when navigating directly to /e/ URLs on page load - Fetching happens in background without blocking user
This commit is contained in:
@@ -68,15 +68,10 @@ export function useEventLoader({
|
||||
setSelectedUrl('') // Don't set nostr: URL to avoid showing highlights
|
||||
setIsCollapsed(false)
|
||||
|
||||
// Otherwise fetch from relays
|
||||
// If no relay pool yet, wait for it or show a placeholder
|
||||
if (!relayPool) {
|
||||
const errorContent: ReadableContent = {
|
||||
url: '',
|
||||
html: `<div style="padding: 1rem; color: var(--color-error, red);">No relay pool available to fetch event</div>`,
|
||||
title: 'Error'
|
||||
}
|
||||
setReaderContent(errorContent)
|
||||
setReaderLoading(false)
|
||||
// Show loading state until relayPool becomes available
|
||||
// The effect will re-run once relayPool is set
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user