mirror of
https://github.com/dergigi/boris.git
synced 2026-01-30 12:14:35 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user