From ab81fe5030137be08549d4b2d9f92d79cc0658a7 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 30 Oct 2025 20:48:53 +0100 Subject: [PATCH] debug: add logging to useHighlightCreation hook - Add [HIGHLIGHT-CREATION] logs to track highlight creation flow - Log when createHighlight function is called - Log highlight properties after creation to verify isLocalOnly is set - This will help debug why [HIGHLIGHT-PUBLISH] logs are missing --- src/hooks/useHighlightCreation.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/hooks/useHighlightCreation.ts b/src/hooks/useHighlightCreation.ts index 6a6826d7..27c9316d 100644 --- a/src/hooks/useHighlightCreation.ts +++ b/src/hooks/useHighlightCreation.ts @@ -44,6 +44,15 @@ export const useHighlightCreation = ({ }, []) const handleCreateHighlight = useCallback(async (text: string) => { + console.log('🎯 [HIGHLIGHT-CREATION] Starting highlight creation process', { + text: text.substring(0, 50) + '...', + hasActiveAccount: !!activeAccount, + hasRelayPool: !!relayPool, + hasEventStore: !!eventStore, + hasCurrentArticle: !!currentArticle, + hasSelectedUrl: !!selectedUrl + }) + if (!activeAccount || !relayPool || !eventStore) { console.error('Missing requirements for highlight creation') return @@ -60,7 +69,7 @@ export const useHighlightCreation = ({ ? currentArticle.content : readerContent?.markdown || readerContent?.html - + console.log('🎯 [HIGHLIGHT-CREATION] Calling createHighlight function') const newHighlight = await createHighlight( text, source, @@ -73,6 +82,12 @@ export const useHighlightCreation = ({ ) // Highlight created successfully + console.log('🎯 [HIGHLIGHT-CREATION] Highlight created successfully:', { + highlightId: newHighlight.id, + isLocalOnly: newHighlight.isLocalOnly, + publishedRelays: newHighlight.publishedRelays, + willShowAirplaneIcon: newHighlight.isLocalOnly + }) // Clear the browser's text selection immediately to allow DOM update const selection = window.getSelection()