debug: add detailed naddr comparison logs

- Show all map keys when looking up reading progress
- Show d-tag generation from naddr in save flow
- This will help identify if naddr encoding/decoding is causing mismatch
This commit is contained in:
Gigi
2025-10-19 11:56:27 +02:00
parent 7c511de474
commit 14fce2c3dc
2 changed files with 11 additions and 2 deletions

View File

@@ -623,7 +623,11 @@ const Explore: React.FC<ExploreProps> = ({ relayPool, eventStore, settings, acti
identifier: dTag
})
const progress = readingProgressMap.get(naddr)
console.log('[progress] 🔍 Looking up:', naddr.slice(0, 50) + '... =>', progress ? Math.round(progress * 100) + '%' : 'not found')
console.log('[progress] 🔍 Looking up:', {
naddr: naddr.slice(0, 80),
mapKeys: Array.from(readingProgressMap.keys()).map(k => k.slice(0, 80)),
progress: progress ? Math.round(progress * 100) + '%' : 'not found'
})
return progress
} catch (err) {
console.error('[progress] ❌ Error encoding naddr:', err)

View File

@@ -48,7 +48,12 @@ function generateDTag(naddrOrUrl: string): string {
try {
const decoded = nip19.decode(naddrOrUrl)
if (decoded.type === 'naddr') {
return `${decoded.data.kind}:${decoded.data.pubkey}:${decoded.data.identifier || ''}`
const dTag = `${decoded.data.kind}:${decoded.data.pubkey}:${decoded.data.identifier || ''}`
console.log('[progress] 📋 Generated d-tag from naddr:', {
naddr: naddrOrUrl.slice(0, 50) + '...',
dTag: dTag.slice(0, 80) + '...'
})
return dTag
}
} catch (e) {
console.warn('Failed to decode naddr:', naddrOrUrl)