From 71e6ffd0893d967bc43e2af14bbe61e24d44895d Mon Sep 17 00:00:00 2001 From: highperfocused Date: Thu, 27 Nov 2025 23:33:25 +0100 Subject: [PATCH] Update hashtag routing in NoteContent and enhance hashtag search logic in useHashtagFeed --- src/components/NoteContent.test.tsx | 4 ++-- src/components/NoteContent.tsx | 2 +- src/hooks/useHashtagFeed.ts | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/NoteContent.test.tsx b/src/components/NoteContent.test.tsx index a3244d1..b4336a9 100644 --- a/src/components/NoteContent.test.tsx +++ b/src/components/NoteContent.test.tsx @@ -98,8 +98,8 @@ describe('NoteContent', () => { expect(nostrHashtag).toBeInTheDocument(); expect(bitcoinHashtag).toBeInTheDocument(); - expect(nostrHashtag).toHaveAttribute('href', '/t/nostr'); - expect(bitcoinHashtag).toHaveAttribute('href', '/t/bitcoin'); + expect(nostrHashtag).toHaveAttribute('href', '/tag/nostr'); + expect(bitcoinHashtag).toHaveAttribute('href', '/tag/bitcoin'); }); it('generates deterministic names for users without metadata and styles them differently', () => { diff --git a/src/components/NoteContent.tsx b/src/components/NoteContent.tsx index a7a7c30..9327ce9 100644 --- a/src/components/NoteContent.tsx +++ b/src/components/NoteContent.tsx @@ -83,7 +83,7 @@ export function NoteContent({ parts.push( {hashtag} diff --git a/src/hooks/useHashtagFeed.ts b/src/hooks/useHashtagFeed.ts index 6c0be5f..13e8c8e 100644 --- a/src/hooks/useHashtagFeed.ts +++ b/src/hooks/useHashtagFeed.ts @@ -8,13 +8,18 @@ import type { NostrEvent } from '@nostrify/nostrify'; export function useHashtagFeed(hashtag: string) { const { nostr } = useNostr(); const normalizedTag = hashtag.toLowerCase(); + + // Search for both normalized and original tag if they differ + const tagsToSearch = normalizedTag === hashtag + ? [normalizedTag] + : [normalizedTag, hashtag]; return useInfiniteQuery({ queryKey: ['hashtag-feed', normalizedTag], queryFn: async ({ pageParam, signal }) => { const filter = pageParam - ? { kinds: [20], '#t': [normalizedTag], limit: 20, until: pageParam as number } - : { kinds: [20], '#t': [normalizedTag], limit: 20 }; + ? { kinds: [20], '#t': tagsToSearch, limit: 20, until: pageParam as number } + : { kinds: [20], '#t': tagsToSearch, limit: 20 }; const events = await nostr.query([filter], { signal: AbortSignal.any([signal, AbortSignal.timeout(1500)])