From 9bf0019e35806aa2e912776542d42f76a402665a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Jan 2026 12:13:18 +0000 Subject: [PATCH] fix: prioritize outbox relays and fix tab switching layout Relay selection fixes: - Change priority: outbox-selected relays > explicit relays > fallback - For profile spells, ALWAYS use author's NIP-65 outbox relays first - Only fall back to explicit spell relays if outbox selection yields nothing - Ensures queries go to where the author actually publishes (their write relays) Layout fixes: - Change TabsContent from flex-1 to h-full in all viewers - Prevents inactive tabs from participating in flex layout calculations - Fixes header stacking/height issues when switching between spell tabs - Each tab now properly fills parent height without layout shifts --- src/components/EventDetailViewer.tsx | 2 +- src/components/ProfileViewer.tsx | 35 +++++++++++++++++----------- src/components/RelayViewer.tsx | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/components/EventDetailViewer.tsx b/src/components/EventDetailViewer.tsx index e3e38ea..8f664ef 100644 --- a/src/components/EventDetailViewer.tsx +++ b/src/components/EventDetailViewer.tsx @@ -222,7 +222,7 @@ function SpellTabContent({ return ( {!appliedFilter ? (
diff --git a/src/components/ProfileViewer.tsx b/src/components/ProfileViewer.tsx index 257d65e..948aa2e 100644 --- a/src/components/ProfileViewer.tsx +++ b/src/components/ProfileViewer.tsx @@ -241,15 +241,6 @@ function SpellTabContent({ return []; } - // Use explicit relays from spell if provided - if (parsed?.relays && parsed.relays.length > 0) { - console.log( - `[SpellTabContent:${spell.name || spellId}] Using explicit relays:`, - parsed.relays, - ); - return parsed.relays; - } - // Wait for outbox relay selection to complete if (relaySelectionPhase !== "ready") { console.log( @@ -258,11 +249,29 @@ function SpellTabContent({ return []; } + // For profile spells, ALWAYS prefer outbox-selected relays over explicit relays + // This ensures we query from the author's write relays (NIP-65) + if (selectedRelays && selectedRelays.length > 0) { + console.log( + `[SpellTabContent:${spell.name || spellId}] Using outbox-selected relays:`, + selectedRelays, + ); + return selectedRelays; + } + + // Fallback to explicit relays from spell if outbox selection yielded nothing + if (parsed?.relays && parsed.relays.length > 0) { + console.log( + `[SpellTabContent:${spell.name || spellId}] Fallback to explicit relays:`, + parsed.relays, + ); + return parsed.relays; + } + console.log( - `[SpellTabContent:${spell.name || spellId}] Using outbox-selected relays:`, - selectedRelays, + `[SpellTabContent:${spell.name || spellId}] No relays available`, ); - return selectedRelays; + return []; }, [ appliedFilter, parsed?.relays, @@ -306,7 +315,7 @@ function SpellTabContent({ return ( {!appliedFilter ? (
diff --git a/src/components/RelayViewer.tsx b/src/components/RelayViewer.tsx index df801af..0576fa5 100644 --- a/src/components/RelayViewer.tsx +++ b/src/components/RelayViewer.tsx @@ -193,7 +193,7 @@ function SpellTabContent({ return ( {!appliedFilter ? (