// Log a sample of highlights without refs for debugging
if (highlightsWithNoRefs <= 3) {
console.debug(`[Bookmarks] Highlight ${highlight.id.substring(0,16)}... has no e-tag or a-tag. Tags:`, highlight.tags.map(t => t[0]).join(', '));
}
}
}
console.log(`[Bookmarks] Found ${highlightBySourceEvent.size} e-tag references and ${aTagHighlights.size} a-tag references`);
console.log(`[Bookmarks] Highlights breakdown: ${highlightsWithETags} with e-tags, ${highlightsWithATags} with a-tags only, ${highlightsWithNoRefs} with no event references`);
// Second pass: fetch events for a-tags in batches (grouped by kind+pubkey+d-tag)
if (aTagHighlights.size > 0) {
@ -312,16 +305,14 @@
@@ -312,16 +305,14 @@
}
}
console.log(`[Bookmarks] Resolved ${eventToATag.size} events from ${aTagGroups.size} a-tag groups`);
} catch (err) {
console.error('[Bookmarks] Error fetching events for a-tags:', err);
// Non-critical: a-tag resolution failed
}
}
}
// Get source event IDs for highlights (to fetch them for sorting/display)
console.error('Error clearing cache by kind:', error);
// Failed to clear cache by kind
alert('Failed to clear cache');
}
}
@ -162,7 +162,7 @@
@@ -162,7 +162,7 @@
await loadEvents(true);
alert(`Deleted ${deleted} events`);
} catch (error) {
console.error('Error clearing cache by date:', error);
// Failed to clear cache by date
alert('Failed to clear cache');
}
}
@ -182,7 +182,7 @@
@@ -182,7 +182,7 @@
await loadEvents(true);
alert(`Deleted ${deleted} events`);
} catch (error) {
console.error('Error clearing cache by kinds:', error);
// Failed to clear cache by kinds
alert('Failed to clear cache');
}
}
@ -202,7 +202,7 @@
@@ -202,7 +202,7 @@
await navigator.clipboard.writeText(json);
// Could show a toast notification here
} catch (error) {
console.error('Error copying to clipboard:', error);
// Failed to copy to clipboard
alert('Failed to copy to clipboard');
}
}
@ -411,20 +411,20 @@
@@ -411,20 +411,20 @@
}
if (retries === 0 && lastError) {
console.error('Error reloading stats after delete (all retries failed):', lastError);
// Failed to reload stats after delete
// Don't show error to user - stats will update on next manual refresh
}
alert(`Delete request published to ${result.success.length} relay(s) and event removed from cache`);
} catch (deleteError) {
console.error('Error deleting from cache:', deleteError);
// Failed to delete from cache
alert(`Delete request published to ${result.success.length} relay(s), but failed to remove from cache: ${deleteErrorinstanceofError?deleteError.message : String(deleteError)}`);
console.debug(`[Highlights] Highlight ${highlight.id.substring(0,16)}... has no e-tag or a-tag. Tags:`, highlight.tags.map(t => t[0]).join(', '));
}
}
}
console.log(`[Highlights] Found ${highlightBySourceEvent.size} e-tag references and ${aTagHighlights.size} a-tag references`);
console.log(`[Highlights] Highlights breakdown: ${highlightsWithETags} with e-tags, ${highlightsWithATags} with a-tags only, ${highlightsWithNoRefs} with no event references`);
// Second pass: fetch events for a-tags in batches (grouped by kind+pubkey+d-tag)
if (aTagHighlights.size > 0) {
@ -307,35 +300,26 @@
@@ -307,35 +300,26 @@
}
}
console.log(`[Highlights] Resolved ${eventToATag.size} events from ${aTagGroups.size} a-tag groups`);
} catch (err) {
console.error('[Highlights] Error fetching events for a-tags:', err);
// Non-critical: a-tag resolution failed, continue with e-tags only
}
}
}
// Get source event IDs for highlights (to fetch them for sorting/display)
console.log(`[Replaceable] Found ${batchEvents.length} additional events from hint relays in kind range ${start}-${Math.min(start+BATCH_SIZE-1,39999)}`);
} catch (e) {
console.warn(`[Replaceable] Failed to query hint relays for kind range ${start}-${Math.min(start+BATCH_SIZE-1,39999)}:`, e);
// Query failed for hint relays (non-critical)
}
}
}
if (allEvents.length > 0) {
console.log(`[Replaceable] Found ${allEvents.length} events total (including cache and hint relays)`);
}
// Also check common replaceable kinds that might have d-tags
@ -185,7 +178,6 @@
@@ -185,7 +178,6 @@
{useCache: true,cacheResults: true}
);
allEvents.push(...commonEvents);
console.log(`[Replaceable] Found ${commonEvents.length} events in common replaceable kinds`);
// For replaceable events, get the newest version of each (by pubkey and kind)
// For parameterized replaceable, get newest by (pubkey, kind, d-tag)
@ -207,13 +199,12 @@
@@ -207,13 +199,12 @@
// Sort by created_at descending
events = Array.from(eventsByKey.values()).sort((a, b) => b.created_at - a.created_at);
console.log(`[Replaceable] Total unique events found: ${events.length}`);
if (events.length === 0 && !error) {
error = `No replaceable events found with d-tag "${dTag}". The event might not be on the queried relays, or the d-tag might be incorrect.`;