mirror of
https://github.com/dergigi/boris.git
synced 2025-12-24 10:04:19 +01:00
debug: add extensive logging to track bookmark flow
Simplified to only show unencrypted bookmarks: - Skip encrypted events entirely (no decrypt for now) - This eliminates all parse errors Added comprehensive logging: - Controller: log when building, how many items, how many listeners, when emitting - App: log when subscribing, when receiving bookmarks, when loading state changes This will help identify where the disconnect is between controller and sidebar.
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -42,10 +42,18 @@ function AppRoutes({
|
||||
|
||||
// Subscribe to bookmark controller
|
||||
useEffect(() => {
|
||||
const unsubBookmarks = bookmarkController.onBookmarks(setBookmarks)
|
||||
const unsubLoading = bookmarkController.onLoading(setBookmarksLoading)
|
||||
console.log('[app] 🎧 Subscribing to bookmark controller')
|
||||
const unsubBookmarks = bookmarkController.onBookmarks((bookmarks) => {
|
||||
console.log('[app] 📥 Received bookmarks:', bookmarks.length)
|
||||
setBookmarks(bookmarks)
|
||||
})
|
||||
const unsubLoading = bookmarkController.onLoading((loading) => {
|
||||
console.log('[app] 📥 Loading state:', loading)
|
||||
setBookmarksLoading(loading)
|
||||
})
|
||||
|
||||
return () => {
|
||||
console.log('[app] 🔇 Unsubscribing from bookmark controller')
|
||||
unsubBookmarks()
|
||||
unsubLoading()
|
||||
}
|
||||
|
||||
@@ -106,14 +106,10 @@ class BookmarkController {
|
||||
): Promise<void> {
|
||||
const allEvents = Array.from(this.currentEvents.values())
|
||||
|
||||
// Only process events that are ready (unencrypted or already decrypted)
|
||||
const readyEvents = allEvents.filter(evt => {
|
||||
const isEncrypted = hasEncryptedContent(evt)
|
||||
if (!isEncrypted) return true // Unencrypted - ready
|
||||
return this.decryptedEvents.has(evt.id) // Encrypted - only if decrypted
|
||||
})
|
||||
// Only process unencrypted events for now (skip encrypted entirely)
|
||||
const readyEvents = allEvents.filter(evt => !hasEncryptedContent(evt))
|
||||
|
||||
console.log('[controller] 📋 Building bookmarks:', readyEvents.length, 'ready of', allEvents.length, 'total')
|
||||
console.log('[controller] 📋 Building bookmarks:', readyEvents.length, 'unencrypted of', allEvents.length, 'total')
|
||||
|
||||
if (readyEvents.length === 0) {
|
||||
this.bookmarksListeners.forEach(cb => cb([]))
|
||||
@@ -231,6 +227,7 @@ class BookmarkController {
|
||||
}
|
||||
|
||||
console.log('[controller] 📋 Built bookmark with', sortedBookmarks.length, 'items')
|
||||
console.log('[controller] 📤 Emitting to', this.bookmarksListeners.length, 'listeners')
|
||||
this.bookmarksListeners.forEach(cb => cb([bookmark]))
|
||||
} catch (error) {
|
||||
console.error('[controller] ❌ Failed to build bookmarks:', error)
|
||||
|
||||
Reference in New Issue
Block a user