From e9f6d5fc3addeffff4ebae5881496245dda1de35 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Dec 2025 22:15:26 +0000 Subject: [PATCH] fix: use resolvedFilter in subscription ID to fix $contacts alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The real bug: subscription ID was using the original filter (with "$contacts" string) while the query used the resolved filter (with actual pubkeys). This caused the subscription to not re-subscribe when contacts were loaded. Flow before fix: 1. Component renders, contacts = [] 2. resolvedFilter has empty authors (since $contacts resolves to []) 3. Subscription ID: req-{"authors":["$contacts"]} (never changes) 4. Query sent with empty authors → no results 5. Contact list loads, contacts populates 6. resolvedFilter recalculates with real pubkeys 7. BUT subscription ID unchanged, so no re-subscribe! 8. Query stuck with empty authors Flow after fix: 1. Subscription ID now uses resolvedFilter 2. When contacts load and resolvedFilter changes, ID changes 3. Hook detects new ID and creates new subscription with actual contact pubkeys 4. Query works correctly Also includes the contactPointer memoization from previous commit. --- src/components/ReqViewer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReqViewer.tsx b/src/components/ReqViewer.tsx index 69e7d01..2b5d6d2 100644 --- a/src/components/ReqViewer.tsx +++ b/src/components/ReqViewer.tsx @@ -761,7 +761,7 @@ export default function ReqViewer({ relayStates: reqRelayStates, overallState, } = useReqTimelineEnhanced( - `req-${JSON.stringify(filter)}-${closeOnEose}`, + `req-${JSON.stringify(resolvedFilter)}-${closeOnEose}`, resolvedFilter, normalizedRelays, { limit: resolvedFilter.limit || 50, stream },