fix: 🐛

This commit is contained in:
codytseng
2025-11-09 22:37:07 +08:00
parent 9b9ecf76d6
commit 485ca82e30
3 changed files with 13 additions and 16 deletions

View File

@@ -20,21 +20,19 @@ export function useFetchEvent(eventId?: string) {
return return
} }
try {
const event = await client.fetchEvent(eventId) const event = await client.fetchEvent(eventId)
if (event && !isEventDeleted(event)) { if (event && !isEventDeleted(event)) {
setEvent(event) setEvent(event)
addReplies([event]) addReplies([event])
} }
} catch (error) {
setError(error as Error)
} finally {
setIsFetching(false)
}
} }
fetchEvent().catch((err) => { fetchEvent()
.catch((err) => {
console.error('Error fetching event in useFetchEvent:', eventId, error)
setError(err as Error) setError(err as Error)
})
.finally(() => {
setIsFetching(false) setIsFetching(false)
}) })
}, [eventId]) }, [eventId])

View File

@@ -202,7 +202,7 @@ class IndexedDbService {
): Promise<Event | undefined | null> { ): Promise<Event | undefined | null> {
const storeName = this.getStoreNameByKind(kind) const storeName = this.getStoreNameByKind(kind)
if (!storeName) { if (!storeName) {
return Promise.reject('store name not found') return undefined
} }
await this.initPromise await this.initPromise
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@@ -90,7 +90,6 @@ class RelayInfoService {
private async fetchRelayNip11(url: string) { private async fetchRelayNip11(url: string) {
try { try {
console.log('Fetching NIP-11 for', url)
const res = await fetch(url.replace('ws://', 'http://').replace('wss://', 'https://'), { const res = await fetch(url.replace('ws://', 'http://').replace('wss://', 'https://'), {
headers: { Accept: 'application/nostr+json' } headers: { Accept: 'application/nostr+json' }
}) })