debug: add detailed logging to highlight application useEffect

- Log when useEffect is triggered
- Log contentRef status, relevant highlights count, and html presence
- Log specific reason when skipping highlight application
- This will help identify why highlights aren't being applied to DOM
This commit is contained in:
Gigi
2025-10-04 21:52:22 +01:00
parent 0255ff5d03
commit e2e5d59197

View File

@@ -85,7 +85,18 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
// Apply highlights after DOM is rendered
useEffect(() => {
if (!contentRef.current || relevantHighlights.length === 0) return
console.log('🔍 useEffect triggered:', {
hasContentRef: !!contentRef.current,
relevantHighlightsCount: relevantHighlights.length,
hasHtml: !!html
})
if (!contentRef.current || relevantHighlights.length === 0) {
console.log('⚠️ Skipping highlight application:', {
reason: !contentRef.current ? 'no contentRef' : 'no relevant highlights'
})
return
}
console.log('🔍 Applying highlights to rendered DOM:', {
highlightsCount: relevantHighlights.length,