fix: disable for you feed using localhost relay
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
kieran 2024-06-18 10:50:49 +01:00
parent 37000ecc7a
commit 229c34eab7
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -1,4 +1,5 @@
import { EventKind, NostrEvent, RequestBuilder, TaggedNostrEvent } from "@snort/system"; import { EventKind, NostrEvent, RequestBuilder, TaggedNostrEvent } from "@snort/system";
import { WorkerRelayInterface } from "@snort/worker-relay";
import { memo, useEffect, useMemo, useState } from "react"; import { memo, useEffect, useMemo, useState } from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { Link, useNavigationType } from "react-router-dom"; import { Link, useNavigationType } from "react-router-dom";
@ -108,14 +109,16 @@ export const ForYouTab = memo(function ForYouTab() {
if (!login.publicKey) { if (!login.publicKey) {
return []; return [];
} }
if (!getForYouFeedPromise) { if (!getForYouFeedPromise && Relay instanceof WorkerRelayInterface) {
getForYouFeedPromise = Relay.forYouFeed(login.publicKey); getForYouFeedPromise = Relay.forYouFeed(login.publicKey);
} }
getForYouFeedPromise!.then(notes => { getForYouFeedPromise!.then(notes => {
getForYouFeedPromise = null; getForYouFeedPromise = null;
if (notes.length < 10) { if (notes.length < 10) {
setTimeout(() => { setTimeout(() => {
getForYouFeedPromise = Relay.forYouFeed(login.publicKey!); if (Relay instanceof WorkerRelayInterface) {
getForYouFeedPromise = Relay.forYouFeed(login.publicKey!);
}
}, 1000); }, 1000);
} }
forYouFeed = { forYouFeed = {
@ -184,7 +187,7 @@ export const ForYouTab = memo(function ForYouTab() {
latest={[]} latest={[]}
displayAs={displayAs} displayAs={displayAs}
loadMore={() => latestFeed.loadMore()} loadMore={() => latestFeed.loadMore()}
showLatest={() => {}} showLatest={() => { }}
/> />
</> </>
); );