refactor: address review comments
This commit is contained in:
@ -22,15 +22,7 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
||||
.kinds([LIVE_STREAM])
|
||||
.authors([link.id]);
|
||||
|
||||
const b2 = new RequestBuilder(`profile-host:${link.id.slice(0, 12)}`);
|
||||
b2.withOptions({
|
||||
leaveOpen,
|
||||
})
|
||||
.withFilter()
|
||||
.kinds([LIVE_STREAM])
|
||||
.tag("p", [link.id]);
|
||||
|
||||
b.add(b2);
|
||||
b.withFilter().kinds([LIVE_STREAM]).tag("p", [link.id]);
|
||||
|
||||
return b;
|
||||
}, [link, leaveOpen]);
|
||||
@ -70,8 +62,14 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
||||
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
|
||||
.filter((z) => z && z.valid && z.receiver === link.id);
|
||||
|
||||
const sortedStreams = useMemo(() => {
|
||||
const sorted = [...streams];
|
||||
sorted.sort((a, b) => b.created_at - a.created_at);
|
||||
return sorted;
|
||||
}, [streams]);
|
||||
|
||||
return {
|
||||
streams,
|
||||
streams: sortedStreams,
|
||||
zaps,
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user