feat: auto-load bookmarks on login and page mount

Added centralized auto-loading effect that handles all scenarios:
- User logs in (activeAccount becomes available)
- Page loads with existing session
- User logs out and back in (bookmarks cleared by reset)

Watches activeAccount and relayPool, triggers when both ready and no
bookmarks loaded yet. Handles all login methods (extension, bunker) via
single reactive effect.
This commit is contained in:
Gigi
2025-10-18 01:05:29 +02:00
parent 6ba1ce27b7
commit bcb6cfbe97

View File

@@ -59,6 +59,14 @@ function AppRoutes({
}
}, [])
// Auto-load bookmarks when account is ready (on login or page mount)
useEffect(() => {
if (activeAccount && relayPool && bookmarks.length === 0 && !bookmarksLoading) {
console.log('[bookmark] 🚀 Auto-loading bookmarks on mount/login')
bookmarkController.start({ relayPool, activeAccount, accountManager })
}
}, [activeAccount, relayPool, bookmarks.length, bookmarksLoading, accountManager])
// Manual refresh (for sidebar button)
const handleRefreshBookmarks = useCallback(async () => {
if (!relayPool || !activeAccount) {