diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index 3e4e40a..ed5bc16 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -168,6 +168,7 @@ const NoteList = forwardRef( setHasMore(true) if (showKinds.length === 0) { + logger.warn('NoteList: showKinds is empty, no events will be displayed') setLoading(false) setHasMore(false) return () => {} diff --git a/src/pages/primary/DiscussionsPage/index.tsx b/src/pages/primary/DiscussionsPage/index.tsx index b847c42..611c371 100644 --- a/src/pages/primary/DiscussionsPage/index.tsx +++ b/src/pages/primary/DiscussionsPage/index.tsx @@ -238,6 +238,14 @@ function analyzeDynamicTopics(entries: EventMapEntry[]): { const allTopics = [...mainTopics, ...subtopics] + // Debug logging + console.log('Dynamic topics analysis:', { + hashtagCounts: Object.fromEntries(hashtagCounts), + mainTopics: mainTopics.map(t => ({ id: t.id, count: t.count })), + subtopics: subtopics.map(t => ({ id: t.id, count: t.count })), + allTopics: allTopics.map(t => ({ id: t.id, count: t.count, isMainTopic: t.isMainTopic, isSubtopic: t.isSubtopic })) + }) + return { mainTopics, subtopics, allTopics } } @@ -632,6 +640,16 @@ const DiscussionsPage = forwardRef(() => { return !!dynamicTopic }) + // Debug logging for subtopic detection + if (entrySubtopics.length > 0) { + console.log('Found subtopics for entry:', { + threadId: entry.event.id.substring(0, 8), + allTopics: entry.allTopics, + entrySubtopics, + dynamicTopics: dynamicTopics.allTopics.map(dt => ({ id: dt.id, isSubtopic: dt.isSubtopic })) + }) + } + if (entrySubtopics.length > 0) { // Group under the first subtopic found const subtopic = entrySubtopics[0] diff --git a/src/providers/KindFilterProvider.tsx b/src/providers/KindFilterProvider.tsx index 09867a4..2ee80ad 100644 --- a/src/providers/KindFilterProvider.tsx +++ b/src/providers/KindFilterProvider.tsx @@ -1,5 +1,7 @@ import { createContext, useContext, useState } from 'react' import storage from '@/services/local-storage.service' +import { SUPPORTED_KINDS } from '@/constants' +import { kinds } from 'nostr-tools' type TKindFilterContext = { showKinds: number[] @@ -17,7 +19,20 @@ export const useKindFilter = () => { } export function KindFilterProvider({ children }: { children: React.ReactNode }) { - const [showKinds, setShowKinds] = useState(storage.getShowKinds()) + // Ensure we always have a default value - show all supported kinds except reposts + const defaultShowKinds = SUPPORTED_KINDS.filter(kind => kind !== kinds.Repost) + const storedShowKinds = storage.getShowKinds() + const [showKinds, setShowKinds] = useState( + storedShowKinds.length > 0 ? storedShowKinds : defaultShowKinds + ) + + // Debug logging + console.log('KindFilterProvider initialized:', { + defaultShowKinds, + storedShowKinds, + finalShowKinds: showKinds, + showKindsLength: showKinds.length + }) const updateShowKinds = (kinds: number[]) => { storage.setShowKinds(kinds)