From 966907a848fa77a03386bb5f928e79654a6ed62e Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Tue, 16 Jun 2026 22:23:00 +0700 Subject: [PATCH] chore: clean up console noise - remove debug logs from NostrProvider, NostrSync, useShakespeare Removed: - [NostrProvider] Routing query to read relays (fired on EVERY query) - [NostrProvider] Publishing kind X to relays - [NostrSync] Starting sync / querying profile / profile query returned / sync completed - [NostrSync] Profile not found on main relays - [NostrSync] Profile synced and cached - [Shakespeare] Fetching / Model / Response status debug logs Kept all warn/error logs for actual failure cases. Co-authored-by: shakespeare.diy --- src/components/NostrProvider.tsx | 3 +-- src/components/NostrSync.tsx | 7 +------ src/hooks/useShakespeare.ts | 4 ---- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/components/NostrProvider.tsx b/src/components/NostrProvider.tsx index 0d01da1..5b55c27 100644 --- a/src/components/NostrProvider.tsx +++ b/src/components/NostrProvider.tsx @@ -62,7 +62,6 @@ const NostrProvider: React.FC = (props) => { routes.set(relay.url, filters); } } else { - console.log('[NostrProvider] Routing query to read relays:', readRelays); for (const url of readRelays) { routes.set(url, filters); } @@ -95,7 +94,7 @@ const NostrProvider: React.FC = (props) => { DEFAULT_RELAYS.forEach(r => allRelays.add(r.url)); } - console.log(`[NostrProvider] Publishing kind ${event.kind} to relays:`, [...allRelays]); + return [...allRelays]; }, diff --git a/src/components/NostrSync.tsx b/src/components/NostrSync.tsx index 82035e1..b110c50 100644 --- a/src/components/NostrSync.tsx +++ b/src/components/NostrSync.tsx @@ -72,7 +72,6 @@ export function NostrSync() { const syncUserData = async () => { setSyncStatus('syncing'); - console.log('[NostrSync] Starting sync for user:', user.pubkey.slice(0, 8) + '...'); // FIX B: Invalidate any stale cached data for this user BEFORE fetching // This ensures we don't use old cached empty results @@ -137,12 +136,10 @@ export function NostrSync() { // Sync profile (kind 0) and populate useAuthor cache const syncProfile = async (relayGroup?: ReturnType): Promise => { const querySource = relayGroup || nostr; - console.log('[NostrSync] Querying profile for pubkey:', user.pubkey.slice(0, 8) + '...'); const events = await querySource.query( [{ kinds: [0], authors: [user.pubkey], limit: 1 }], { signal: AbortSignal.timeout(10000) } ); - console.log('[NostrSync] Profile query returned', events.length, 'events'); if (events.length > 0) { const event = events[0]; @@ -178,7 +175,7 @@ export function NostrSync() { }); }); - console.log('[NostrSync] Profile synced and cached:', metadata.name || 'unnamed'); + return true; } catch (parseError) { // Event exists but content couldn't be parsed - still cache the event @@ -206,7 +203,6 @@ export function NostrSync() { // If profile not found on main relays, try fallback relays if (!profileSynced) { - console.log('[NostrSync] Profile not found on main relays, trying fallbacks...'); const fallbackResult = await syncWithRetry(async () => { const fallbackGroup = nostr.group(FALLBACK_RELAYS); @@ -223,7 +219,6 @@ export function NostrSync() { if (relaysSynced || profileSynced) { setSyncStatus('success'); - console.log('[NostrSync] Sync completed - relays:', relaysSynced, 'profile:', profileSynced); } else { setSyncStatus('error'); console.error('[NostrSync] Sync failed - could not reach relays'); diff --git a/src/hooks/useShakespeare.ts b/src/hooks/useShakespeare.ts index 6bfa682..283ba11 100644 --- a/src/hooks/useShakespeare.ts +++ b/src/hooks/useShakespeare.ts @@ -177,9 +177,6 @@ export function useShakespeare() { const targetUrl = `${SHAKESPEARE_API_URL}/chat/completions`; const token = await createNIP98Token('POST', targetUrl, requestBody, user); - console.log('[Shakespeare] Fetching:', targetUrl); - console.log('[Shakespeare] Model:', model, 'User pubkey:', user.pubkey?.slice(0, 8)); - const response = await fetch(targetUrl, { method: 'POST', headers: { @@ -189,7 +186,6 @@ export function useShakespeare() { body: JSON.stringify(requestBody), }); - console.log('[Shakespeare] Response status:', response.status); await handleAPIError(response); return await response.json(); } catch (err) {