mirror of
https://github.com/dergigi/boris.git
synced 2026-01-07 17:04:34 +01:00
refactor: remove loading state and show bookmarks as they arrive
- Remove loading state variable from Bookmarks component - Remove 'Loading bookmarks...' screen - Start with empty list and populate bookmarks in background - Remove timeout and loading callbacks from fetchBookmarks - Better UX: show UI immediately, bookmarks appear when ready - Bookmarks.tsx now at 197 lines
This commit is contained in:
@@ -28,7 +28,6 @@ const RELAY_URLS = [
|
||||
|
||||
const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
const [bookmarks, setBookmarks] = useState<Bookmark[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [highlights, setHighlights] = useState<Highlight[]>([])
|
||||
const [highlightsLoading, setHighlightsLoading] = useState(true)
|
||||
const [selectedUrl, setSelectedUrl] = useState<string | undefined>(undefined)
|
||||
@@ -69,9 +68,8 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
|
||||
const handleFetchBookmarks = async () => {
|
||||
if (!relayPool || !activeAccount) return
|
||||
const timeoutId = setTimeout(() => setLoading(false), 15000)
|
||||
const fullAccount = accountManager.getActive()
|
||||
await fetchBookmarks(relayPool, fullAccount || activeAccount, setBookmarks, setLoading, timeoutId)
|
||||
await fetchBookmarks(relayPool, fullAccount || activeAccount, setBookmarks)
|
||||
}
|
||||
|
||||
const handleFetchHighlights = async () => {
|
||||
@@ -132,14 +130,6 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="bookmarks-container">
|
||||
<div className="loading">Loading bookmarks...</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`three-pane ${isCollapsed ? 'sidebar-collapsed' : ''} ${isHighlightsCollapsed ? 'highlights-collapsed' : ''}`}>
|
||||
|
||||
Reference in New Issue
Block a user