mirror of
https://github.com/hoornet/vega.git
synced 2026-05-06 20:29:12 -07:00
Add retry-on-empty for followers, articles, and hashtag feeds
Same pattern as profile notes and notifications: if the first relay fetch returns empty, wait 3s and retry once. Prevents false "No X found" messages when relays are slow to connect.
This commit is contained in:
@@ -13,11 +13,22 @@ export function HashtagFeed() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!tag) return;
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
setNotes([]);
|
||||
fetchHashtagFeed(tag)
|
||||
.then(setNotes)
|
||||
.finally(() => setLoading(false));
|
||||
(async () => {
|
||||
let result = await fetchHashtagFeed(tag).catch(() => [] as NDKEvent[]);
|
||||
if (result.length === 0 && !cancelled) {
|
||||
await new Promise((r) => setTimeout(r, 3000));
|
||||
if (cancelled) return;
|
||||
result = await fetchHashtagFeed(tag).catch(() => [] as NDKEvent[]);
|
||||
}
|
||||
if (!cancelled) {
|
||||
setNotes(result);
|
||||
setLoading(false);
|
||||
}
|
||||
})();
|
||||
return () => { cancelled = true; };
|
||||
}, [tag]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user