Compare commits

...

5 Commits

4 changed files with 29 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
{
"VERSION": "v0.7.88",
"VERSION_NUMBER": "0.7.88",
"BUILD_DATE": "2026-07-01T19:56:16.258Z"
"VERSION": "v0.7.93",
"VERSION_NUMBER": "0.7.93",
"BUILD_DATE": "2026-07-03T10:29:34.780Z"
}

View File

@@ -1049,9 +1049,8 @@ function pruneSeenEventIds(seenEventIds) {
function wireSubscriptionHandlers(subId, state, filtersForCache) {
if (!state?.sub) return;
state.sub.on('event', async (event) => {
state.sub.on('event', (event) => {
if (state.seenEventIds.has(event.id)) {
console.log('[Worker] Dedup dropped event for sub:', subId, 'id:', event.id);
return;
}
@@ -1063,14 +1062,7 @@ function wireSubscriptionHandlers(subId, state, filtersForCache) {
state.lastEventCreatedAt = Math.max(Number(state.lastEventCreatedAt || 0), createdAt);
}
console.log('[Worker] Event received for sub:', subId, 'kind:', event.kind, 'id:', event.id);
if (isWorkerEventMuted(event)) {
console.log('[Worker][mute] Filtered muted event for sub:', subId, {
id: event?.id || null,
kind: event?.kind || null,
pubkey: event?.pubkey || null,
});
return;
}
@@ -1079,14 +1071,14 @@ function wireSubscriptionHandlers(subId, state, filtersForCache) {
trackRelayRead(event.relay.url);
}
// Cache the event to IndexedDB
// Cache the event to IndexedDB — fire-and-forget (NOT awaited).
// Awaiting serializes all incoming events through IndexedDB I/O,
// which blocks the worker's event loop and starves port.onmessage
// handlers (getRelayData, getRelayStats, etc.), causing 15s timeouts
// and relay indicators disappearing over extended sessions.
if (ndk.cacheAdapter && typeof ndk.cacheAdapter.setEvent === 'function') {
try {
await ndk.cacheAdapter.setEvent(event, filtersForCache, event.relay);
console.log('[Worker] Cached event:', event.id, 'from relay:', event.relay?.url);
} catch (error) {
console.error('[Worker] Failed to cache event:', error);
}
void ndk.cacheAdapter.setEvent(event, filtersForCache, event.relay)
.catch(error => console.error('[Worker] Failed to cache event:', error));
}
broadcast({

View File

@@ -457,6 +457,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
const timeElements = new Map();
const postImageCache = new Map();
const targetEventCache = new Map();
const detachedInteractionBars = new Map();
let interactions = null;
let notifInteractionsSubId = null;
let visibleNotificationsCount = NOTIFICATIONS_PAGE_SIZE;
@@ -1104,21 +1105,22 @@ import { createProfileCache } from './js/profile-cache.mjs';
// Add interaction menu items (Like, Comment, Quote, Zap, Nutzap) when
// the notification references a target post. The actual interaction
// logic (publishing, zap dialogs, balance checks) is handled by the
// post-interactions module via a hidden interaction bar appended to
// the row. Menu items trigger clicks on the corresponding buttons
// in that hidden bar.
// post-interactions module via a detached interaction bar (kept out of
// the DOM so it never shows up in the row). Menu items trigger clicks
// on the corresponding buttons in that detached bar.
if (item.targetEventId && interactions) {
const targetPubkey = item.targetPubkey || currentPubkey;
const targetEventData = { id: item.targetEventId, pubkey: targetPubkey };
const hiddenBar = interactions.renderInteractionBar(
item.targetEventId,
targetEventData,
{ currentPubkey }
);
hiddenBar.style.display = 'none';
hiddenBar.dataset.notifHiddenBar = item.targetEventId;
row.appendChild(hiddenBar);
let hiddenBar = detachedInteractionBars.get(item.id);
if (!hiddenBar) {
hiddenBar = interactions.renderInteractionBar(
item.targetEventId,
targetEventData,
{ currentPubkey }
);
detachedInteractionBars.set(item.id, hiddenBar);
}
const addMenuBtn = (label, selector) => {
const btn = document.createElement('button');
@@ -1206,6 +1208,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
divNotifications.innerHTML = '';
timeElements.clear();
detachedInteractionBars.clear();
for (const item of visibleItems) {
const row = buildNotificationRow(item);
@@ -1502,6 +1505,7 @@ import { createProfileCache } from './js/profile-cache.mjs';
notificationsReadAt = readAt;
notificationsById.clear();
unreadNotificationsById.clear();
detachedInteractionBars.clear();
visibleNotificationsCount = NOTIFICATIONS_PAGE_SIZE;
renderNotifications();

View File

@@ -491,17 +491,9 @@ import { initPostCards } from './js/post-interactions2.mjs';
}
function handleComposerCommentIntent({ postId, postPubkey }) {
const postEl = document.querySelector(`.divPostItem[data-post-id="${postId}"]`);
if (!postEl) return false;
const entry = getOrCreateInlineComposer(postId, postEl);
if (!entry) return false;
entry.tags = [
['e', postId, '', 'reply'],
['p', postPubkey]
];
if (entry.instance?.show) entry.instance.show();
return focusInlineComposer(entry.hostEl, '');
if (!postId) return false;
window.open('./post-feed.html?event=' + encodeURIComponent(postId), '_blank');
return true;
}
function handleComposerQuoteIntent({ postId, postPubkey }) {