diff --git a/src/components/NoteList/index.tsx b/src/components/NoteList/index.tsx index c1b77ffa..c7dd27c8 100644 --- a/src/components/NoteList/index.tsx +++ b/src/components/NoteList/index.tsx @@ -122,7 +122,7 @@ export default function NoteList({ const options = { root: null, rootMargin: '10px', - threshold: 1 + threshold: 0.1 } const observerInstance = new IntersectionObserver((entries) => { @@ -142,7 +142,7 @@ export default function NoteList({ observerInstance.unobserve(currentBottomRef) } } - }, [refreshing, hasMore, events, timelineKey]) + }, [refreshing, hasMore, events, timelineKey, bottomRef]) const loadMore = async () => { if (!timelineKey || refreshing) return diff --git a/src/lib/pubkey.ts b/src/lib/pubkey.ts index e26a4ee2..126dc9c1 100644 --- a/src/lib/pubkey.ts +++ b/src/lib/pubkey.ts @@ -35,6 +35,9 @@ export function userIdToPubkey(userId: string) { if (userId.startsWith('npub1')) { const { data } = nip19.decode(userId as `npub1${string}`) return data + } else if (userId.startsWith('nprofile1')) { + const { data } = nip19.decode(userId as `nprofile1${string}`) + return data.pubkey } return userId } diff --git a/src/providers/FeedProvider.tsx b/src/providers/FeedProvider.tsx index c406febd..d5ee5d0b 100644 --- a/src/providers/FeedProvider.tsx +++ b/src/providers/FeedProvider.tsx @@ -57,6 +57,7 @@ export function FeedProvider({ children }: { children: React.ReactNode }) { if (feedType === 'following') { return await switchFeed('following', { pubkey }) } else { + console.log('activeRelaySetId', activeRelaySetId) await switchFeed('relays', { activeRelaySetId }) } } diff --git a/src/services/client.service.ts b/src/services/client.service.ts index 395a6732..17f03a18 100644 --- a/src/services/client.service.ts +++ b/src/services/client.service.ts @@ -4,7 +4,7 @@ import { getProfileFromProfileEvent, getRelayListFromRelayListEvent } from '@/lib/event' -import { userIdToPubkey } from '@/lib/pubkey' +import { formatPubkey, userIdToPubkey } from '@/lib/pubkey' import { TDraftEvent, TProfile, TRelayInfo, TRelayList } from '@/types' import { sha256 } from '@noble/hashes/sha2' import DataLoader from 'dataloader' @@ -393,7 +393,7 @@ class ClientService extends EventTarget { try { const pubkey = userIdToPubkey(id) - return { pubkey, username: pubkey } + return { pubkey, username: formatPubkey(pubkey) } } catch { return undefined } diff --git a/src/services/storage.service.ts b/src/services/storage.service.ts index 2f322e6f..0702a1cc 100644 --- a/src/services/storage.service.ts +++ b/src/services/storage.service.ts @@ -91,7 +91,8 @@ class StorageService { this.activeRelaySetId = activeRelaySetId } else { this.relaySets = JSON.parse(relaySetsStr) - this.activeRelaySetId = window.localStorage.getItem(StorageKey.ACTIVE_RELAY_SET_ID) ?? null + const activeRelaySetIdStr = window.localStorage.getItem(StorageKey.ACTIVE_RELAY_SET_ID) + this.activeRelaySetId = activeRelaySetIdStr ? JSON.parse(activeRelaySetIdStr) : null } }