diff --git a/src/components/Me.tsx b/src/components/Me.tsx index d565b899..39470a84 100644 --- a/src/components/Me.tsx +++ b/src/components/Me.tsx @@ -49,6 +49,7 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr const [reads, setReads] = useState([]) const [writings, setWritings] = useState([]) const [loading, setLoading] = useState(true) + const [loadingReads, setLoadingReads] = useState(false) const [viewMode, setViewMode] = useState('cards') const [refreshTrigger, setRefreshTrigger] = useState(0) const [bookmarkFilter, setBookmarkFilter] = useState('all') @@ -89,6 +90,7 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr setHighlights(userHighlights) setWritings(userWritings) + setLoading(false) // Done loading public data // Only fetch private data for own profile if (isOwnProfile && activeAccount) { @@ -104,9 +106,11 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr setBookmarks([]) } - // Fetch all reads + // Fetch all reads (async, may take time) + setLoadingReads(true) const userReads = await fetchAllReads(relayPool, viewingPubkey, fetchedBookmarks) setReads(userReads) + setLoadingReads(false) // Update cache with all fetched data setCachedMeData(viewingPubkey, userHighlights, fetchedBookmarks, userReads) @@ -116,8 +120,6 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr } } catch (err) { console.error('Failed to load data:', err) - // No blocking error - user can pull-to-refresh - } finally { setLoading(false) } } @@ -256,16 +258,6 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr return true } }) - - // Debug logging - if (activeTab === 'reads' && reads.length > 0) { - console.log('📊 [Me/Reads] Debug:', { - totalReads: reads.length, - filteredReads: filteredReads.length, - currentFilter: readingProgressFilter, - sampleRead: reads[0] - }) - } const sections: Array<{ key: string; title: string; items: IndividualBookmark[] }> = [ { key: 'private', title: 'Private Bookmarks', items: groups.privateItems }, { key: 'public', title: 'Public Bookmarks', items: groups.publicItems }, @@ -385,7 +377,8 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr ) case 'reads': - if (showSkeletons) { + // Show skeletons while loading reads OR while initial load + if (showSkeletons || loadingReads) { return (
{Array.from({ length: 6 }).map((_, i) => ( @@ -394,7 +387,7 @@ const Me: React.FC = ({ relayPool, activeTab: propActiveTab, pubkey: pr
) } - return reads.length === 0 && !loading ? ( + return reads.length === 0 && !loading && !loadingReads ? (
No articles in your reads.