From bcb6cfbe97425b9e22e4a0675e669390d71e7b41 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sat, 18 Oct 2025 01:05:29 +0200 Subject: [PATCH] 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. --- src/App.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index 4cfbf471..dd1e2c6c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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) {