mirror of
https://github.com/dergigi/boris.git
synced 2025-12-20 16:14:20 +01:00
fix: correct fetchBookmarks usage with callback pattern in Me component
This commit is contained in:
@@ -40,16 +40,22 @@ const Me: React.FC<MeProps> = ({ relayPool }) => {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
|
||||||
// Fetch all data in parallel
|
// Fetch highlights and read articles
|
||||||
const [userHighlights, userBookmarks, userReadArticles] = await Promise.all([
|
const [userHighlights, userReadArticles] = await Promise.all([
|
||||||
fetchHighlights(relayPool, activeAccount.pubkey),
|
fetchHighlights(relayPool, activeAccount.pubkey),
|
||||||
fetchBookmarks(relayPool, activeAccount, settings).catch(() => ({ bookmarks: [] })),
|
|
||||||
fetchReadArticles(relayPool, activeAccount.pubkey)
|
fetchReadArticles(relayPool, activeAccount.pubkey)
|
||||||
])
|
])
|
||||||
|
|
||||||
setHighlights(userHighlights)
|
setHighlights(userHighlights)
|
||||||
setBookmarks(Array.isArray(userBookmarks) ? userBookmarks : userBookmarks?.bookmarks || [])
|
|
||||||
setReadArticles(userReadArticles)
|
setReadArticles(userReadArticles)
|
||||||
|
|
||||||
|
// Fetch bookmarks using callback pattern
|
||||||
|
try {
|
||||||
|
await fetchBookmarks(relayPool, activeAccount, setBookmarks, settings)
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Failed to load bookmarks:', err)
|
||||||
|
setBookmarks([])
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to load data:', err)
|
console.error('Failed to load data:', err)
|
||||||
setError('Failed to load data. Please try again.')
|
setError('Failed to load data. Please try again.')
|
||||||
|
|||||||
Reference in New Issue
Block a user