diff --git a/src/components/NoteStats/LikeButton.tsx b/src/components/NoteStats/LikeButton.tsx index ef58b338..e57d8d22 100644 --- a/src/components/NoteStats/LikeButton.tsx +++ b/src/components/NoteStats/LikeButton.tsx @@ -272,7 +272,7 @@ export function LikeButtonWithStats({ // Discussions (kind 11) and kind 1111 under a discussion: only +/- vote reactions if (showDiscussionVotes) { return ( -
+
{DISCUSSION_VOTE_EMOJIS.map((emoji, index) => { const isSelected = index === 0 ? isDiscussionUpvoteEmoji(myLastEmoji) : isDiscussionDownvoteEmoji(myLastEmoji) @@ -282,13 +282,13 @@ export function LikeButtonWithStats({
{!hideCount && (noteStats?.updatedAt != null || count > 0) ? ( -
+
{count >= 100 ? '99+' : count}
diff --git a/src/components/NoteStats/ZapButton.tsx b/src/components/NoteStats/ZapButton.tsx index 0cda25cb..05acb7cc 100644 --- a/src/components/NoteStats/ZapButton.tsx +++ b/src/components/NoteStats/ZapButton.tsx @@ -221,7 +221,7 @@ export function ZapButtonWithStats({ event, hideCount = false, noteStats }: ZapB return ( <> -
+
+ ) +} diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index bb70e95c..e0da2669 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -9,6 +9,7 @@ import PostButton from './PostButton' import RssButton from './RssButton' import SearchButton from './SearchButton' import FavoritesButton from './FavoritesButton' +import DiscussionsButton from './DiscussionsButton' import SpellsButton from './SpellsButton' import { ConnectedRelaysSidebarStrip } from '@/components/ConnectedRelays/ConnectedRelaysSidebarStrip' import PaneModeToggle from './PaneModeToggle' @@ -43,6 +44,7 @@ export default function PrimaryPageSidebar() { + diff --git a/src/hooks/useConsoleLogBuffer.ts b/src/hooks/useConsoleLogBuffer.ts index b5959f9f..38bf4b8f 100644 --- a/src/hooks/useConsoleLogBuffer.ts +++ b/src/hooks/useConsoleLogBuffer.ts @@ -9,11 +9,11 @@ function subscribe(onStoreChange: () => void) { return subscribeConsoleLogBuffer(onStoreChange) } -function getSnapshot(): ConsoleLogEntry[] { +function getSnapshot(): readonly ConsoleLogEntry[] { return getConsoleLogBuffer() } /** Live view of the global console log ring buffer (see Settings → Cache). */ -export function useConsoleLogBuffer(): ConsoleLogEntry[] { +export function useConsoleLogBuffer(): readonly ConsoleLogEntry[] { return useSyncExternalStore(subscribe, getSnapshot, getSnapshot) } diff --git a/src/lib/console-log-buffer.ts b/src/lib/console-log-buffer.ts index b61b3649..daa18993 100644 --- a/src/lib/console-log-buffer.ts +++ b/src/lib/console-log-buffer.ts @@ -78,6 +78,10 @@ function formatArgs(args: unknown[]): { message: string; formattedParts: Array<{ function captureLog(type: string, ...args: unknown[]) { const { message, formattedParts } = formatArgs(args) + // nostr-tools emits relay NOTICE via console.debug; keep buffer useful for real diagnostics. + if (message.includes('NOTICE from')) { + return + } buffer.push({ type, message, formattedParts, timestamp: Date.now() }) if (buffer.length > MAX_ENTRIES) { buffer.splice(0, buffer.length - MAX_ENTRIES) diff --git a/src/lib/error-suppression.ts b/src/lib/error-suppression.ts index df91b441..cd1e2f17 100644 --- a/src/lib/error-suppression.ts +++ b/src/lib/error-suppression.ts @@ -106,6 +106,17 @@ function isExpectedDevAppNoise(message: string): boolean { return false } +/** nostr-tools logs relay NOTICE via console.debug; timeout / too-many-steps are normal under load. */ +function isExpectedNostrRelayNotice(message: string): boolean { + return ( + message.includes('NOTICE from') || + message.includes('Too many subscriptions') || + message.includes('Subscription rejected') || + message.includes('too many concurrent REQs') || + message.includes('too many kinds') + ) +} + function isExpectedRelayWebSocketNoise(message: string): boolean { if (message.includes('WebSocket connection to') || message.includes('Close received after close')) { return true @@ -236,17 +247,16 @@ function suppressExpectedErrors() { return } - // Suppress nostr-tools "too many concurrent REQs" errors - if (message.includes('NOTICE from') && message.includes('ERROR: too many concurrent REQs')) { + // Suppress nostr-tools relay NOTICE / overload errors + if (isExpectedNostrRelayNotice(message)) { return } - - // Suppress nostr-tools connection errors - if (message.includes('NOTICE from') && ( - message.includes('ERROR:') || - message.includes('connection closed') || - message.includes('connection errored') - )) { + if ( + message.includes('NOTICE from') && + (message.includes('ERROR:') || + message.includes('connection closed') || + message.includes('connection errored')) + ) { return } @@ -398,12 +408,7 @@ function suppressExpectedErrors() { return } - // Suppress Nostr relay NOTICE messages (too many subscriptions, too many REQs, etc.) - if (message.includes('NOTICE from') || - message.includes('Too many subscriptions') || - message.includes('Subscription rejected') || - message.includes('too many concurrent REQs') || - message.includes('too many kinds')) { + if (isExpectedNostrRelayNotice(message)) { return } @@ -449,12 +454,7 @@ function suppressExpectedErrors() { return } - // Suppress nostr-tools / relay NOTICE messages (subscription limits, REQ limits, etc.) - if (message.includes('NOTICE from') || - message.includes('Too many subscriptions') || - message.includes('Subscription rejected') || - message.includes('too many concurrent REQs') || - message.includes('too many kinds')) { + if (isExpectedNostrRelayNotice(message)) { return } @@ -466,6 +466,22 @@ function suppressExpectedErrors() { // Call original console.log for unexpected logs originalConsoleLog.apply(console, args) } + + const originalConsoleDebug = console.debug + + console.debug = (...args: any[]) => { + const message = formatConsoleArgs(args) + + if (isExpectedNostrRelayNotice(message)) { + return + } + + if (import.meta.env.DEV && isExpectedDevAppNoise(message)) { + return + } + + originalConsoleDebug.apply(console, args) + } } // Suppress unhandled promise rejections that are expected (e.g. SW "operation is insecure" in dev) diff --git a/src/pages/primary/NoteListPage/index.tsx b/src/pages/primary/NoteListPage/index.tsx index bf636b7c..f585969c 100644 --- a/src/pages/primary/NoteListPage/index.tsx +++ b/src/pages/primary/NoteListPage/index.tsx @@ -20,6 +20,7 @@ import React, { } from 'react' import { useTranslation } from 'react-i18next' import Logo from '@/assets/Logo' +import { DiscussionsTitlebarButton } from '@/components/Sidebar/DiscussionsButton' import RelaysFeed from './RelaysFeed' import { usePrimaryPage } from '@/contexts/primary-page-context' import { usePrimaryNoteView } from '@/contexts/primary-note-view-context' @@ -191,6 +192,7 @@ function NoteListPageTitlebar({ > +