mirror of
https://github.com/dergigi/boris.git
synced 2025-12-22 00:54:21 +01:00
debug: add comprehensive logging for reading position calculation and event publishing
- Add logs in useReadingPosition: scroll position calculation (throttled to 5% changes) - Add logs for scheduling and triggering auto-save - Add detailed logs in ContentPanel handleSavePosition - Add logs in saveReadingPosition: event creation, signing, publishing - Add logs in publishEvent: event store addition, relay status, publishing - All logs prefixed with [progress] for easy filtering - Shows complete flow from scroll → calculate → save → create event → publish to relays
This commit is contained in:
@@ -151,7 +151,7 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
// Callback to save reading position
|
||||
const handleSavePosition = useCallback(async (position: number) => {
|
||||
if (!activeAccount || !relayPool || !eventStore || !articleIdentifier) {
|
||||
console.log('⏭️ [ContentPanel] Skipping save - missing requirements:', {
|
||||
console.log('[progress] ⏭️ ContentPanel: Skipping save - missing requirements:', {
|
||||
hasAccount: !!activeAccount,
|
||||
hasRelayPool: !!relayPool,
|
||||
hasEventStore: !!eventStore,
|
||||
@@ -160,11 +160,18 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
return
|
||||
}
|
||||
if (!settings?.syncReadingPosition) {
|
||||
console.log('⏭️ [ContentPanel] Sync disabled in settings')
|
||||
console.log('[progress] ⏭️ ContentPanel: Sync disabled in settings')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('💾 [ContentPanel] Saving position:', Math.round(position * 100) + '%', 'for article:', selectedUrl?.slice(0, 50))
|
||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
||||
console.log('[progress] 💾 ContentPanel: Saving position:', {
|
||||
position,
|
||||
percentage: Math.round(position * 100) + '%',
|
||||
scrollTop,
|
||||
articleIdentifier: articleIdentifier.slice(0, 50) + '...',
|
||||
url: selectedUrl?.slice(0, 50)
|
||||
})
|
||||
|
||||
try {
|
||||
const factory = new EventFactory({ signer: activeAccount })
|
||||
@@ -176,11 +183,12 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
{
|
||||
position,
|
||||
timestamp: Math.floor(Date.now() / 1000),
|
||||
scrollTop: window.pageYOffset || document.documentElement.scrollTop
|
||||
scrollTop
|
||||
}
|
||||
)
|
||||
console.log('[progress] ✅ ContentPanel: Save completed successfully')
|
||||
} catch (error) {
|
||||
console.error('❌ [ContentPanel] Failed to save reading position:', error)
|
||||
console.error('[progress] ❌ ContentPanel: Failed to save reading position:', error)
|
||||
}
|
||||
}, [activeAccount, relayPool, eventStore, articleIdentifier, settings?.syncReadingPosition, selectedUrl])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user