bug: search page fix
This commit is contained in:
@ -47,7 +47,7 @@ export const DefaultRelays = new Map<string, RelaySettings>([
|
||||
/**
|
||||
* Default search relays
|
||||
*/
|
||||
export const SearchRelays = new Map<string, RelaySettings>([["wss://relay.nostr.band", { read: true, write: false }]]);
|
||||
export const SearchRelays = ["wss://relay.nostr.band"];
|
||||
|
||||
/**
|
||||
* List of recommended follows for new users
|
||||
|
@ -17,7 +17,10 @@ export default function useEventFeed(link: NostrLink) {
|
||||
f.kinds([unwrap(link.kind)]);
|
||||
}
|
||||
} else {
|
||||
const f = b.withFilter().id(link.id, link.relays?.at(0));
|
||||
const f = b.withFilter().ids([link.id]);
|
||||
if (link.relays) {
|
||||
link.relays.slice(0, 2).forEach(r => f.relay(r));
|
||||
}
|
||||
if (link.author) {
|
||||
f.authors([link.author]);
|
||||
}
|
||||
|
@ -22,9 +22,12 @@ export default function useThreadFeed(link: NostrLink) {
|
||||
leaveOpen: true,
|
||||
});
|
||||
if (trackingEvents.length > 0) {
|
||||
const fTracking = sub.withFilter();
|
||||
for (const te of trackingEvents) {
|
||||
fTracking.id(te.id, te.relay);
|
||||
const fTracking = sub.withFilter();
|
||||
fTracking.ids([te.id]);
|
||||
if (te.relay) {
|
||||
fTracking.relay(te.relay);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allEvents.length > 0) {
|
||||
|
@ -6,6 +6,7 @@ import { unixNow, unwrap, tagFilterOfTextRepost } from "SnortUtils";
|
||||
import useTimelineWindow from "Hooks/useTimelineWindow";
|
||||
import useLogin from "Hooks/useLogin";
|
||||
import { System } from "index";
|
||||
import { SearchRelays } from "Const";
|
||||
|
||||
export interface TimelineFeedOptions {
|
||||
method: "TIME_RANGE" | "LIMIT_UNTIL";
|
||||
@ -64,10 +65,12 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
|
||||
}
|
||||
case "profile_keyword": {
|
||||
f.search(subject.items[0] + " sort:popular");
|
||||
SearchRelays.forEach(r => f.relay(r));
|
||||
break;
|
||||
}
|
||||
case "post_keyword": {
|
||||
f.search(subject.items[0]);
|
||||
SearchRelays.forEach(r => f.relay(r));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ import Timeline from "Element/Timeline";
|
||||
import { Tab, TabElement } from "Element/Tabs";
|
||||
import { useEffect, useState } from "react";
|
||||
import { debounce } from "SnortUtils";
|
||||
import { System, router } from "index";
|
||||
import { SearchRelays } from "Const";
|
||||
import { router } from "index";
|
||||
import TrendingUsers from "Element/TrendingUsers";
|
||||
|
||||
import TrendingNotes from "Element/TrendingPosts";
|
||||
@ -39,21 +38,6 @@ const SearchPage = () => {
|
||||
return debounce(500, () => setKeyword(search));
|
||||
}, [search]);
|
||||
|
||||
useEffect(() => {
|
||||
const addedRelays: string[] = [];
|
||||
for (const [k, v] of SearchRelays) {
|
||||
if (!System.Sockets.some(v => v.address === k)) {
|
||||
System.ConnectToRelay(k, v);
|
||||
addedRelays.push(k);
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
for (const r of addedRelays) {
|
||||
System.DisconnectRelay(r);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
function tabContent() {
|
||||
if (!keyword) {
|
||||
switch (tab.value) {
|
||||
|
Reference in New Issue
Block a user