forked from Kieran/snort
fix note collections
This commit is contained in:
parent
6851fe0b2b
commit
7c2340d7fb
@ -1,5 +1,5 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { HexKey, EventKind, PubkeyReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
import { HexKey, EventKind, NoteCollection, RequestBuilder } from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
import { System } from "index";
|
import { System } from "index";
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ export default function useFollowersFeed(pubkey?: HexKey) {
|
|||||||
return b;
|
return b;
|
||||||
}, [pubkey]);
|
}, [pubkey]);
|
||||||
|
|
||||||
const followersFeed = useRequestBuilder<PubkeyReplaceableNoteStore>(System, PubkeyReplaceableNoteStore, sub);
|
const followersFeed = useRequestBuilder<NoteCollection>(System, NoteCollection, sub);
|
||||||
|
|
||||||
const followers = useMemo(() => {
|
const followers = useMemo(() => {
|
||||||
const contactLists = followersFeed.data?.filter(
|
const contactLists = followersFeed.data?.filter(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { HexKey, TaggedRawEvent, EventKind, PubkeyReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
import { HexKey, TaggedRawEvent, EventKind, NoteCollection, RequestBuilder } from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
|
|
||||||
import useLogin from "Hooks/useLogin";
|
import useLogin from "Hooks/useLogin";
|
||||||
@ -16,7 +16,7 @@ export default function useFollowsFeed(pubkey?: HexKey) {
|
|||||||
return b;
|
return b;
|
||||||
}, [isMe, pubkey]);
|
}, [isMe, pubkey]);
|
||||||
|
|
||||||
const contactFeed = useRequestBuilder<PubkeyReplaceableNoteStore>(System, PubkeyReplaceableNoteStore, sub);
|
const contactFeed = useRequestBuilder<NoteCollection>(System, NoteCollection, sub);
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
if (isMe) {
|
if (isMe) {
|
||||||
return follows.item;
|
return follows.item;
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import {
|
import { HexKey, TaggedRawEvent, Lists, EventKind, NoteCollection, RequestBuilder } from "@snort/system";
|
||||||
HexKey,
|
|
||||||
TaggedRawEvent,
|
|
||||||
Lists,
|
|
||||||
EventKind,
|
|
||||||
ParameterizedReplaceableNoteStore,
|
|
||||||
RequestBuilder,
|
|
||||||
} from "@snort/system";
|
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
|
|
||||||
import { getNewest } from "SnortUtils";
|
import { getNewest } from "SnortUtils";
|
||||||
@ -24,11 +17,7 @@ export default function useMutedFeed(pubkey?: HexKey) {
|
|||||||
return b;
|
return b;
|
||||||
}, [pubkey]);
|
}, [pubkey]);
|
||||||
|
|
||||||
const mutedFeed = useRequestBuilder<ParameterizedReplaceableNoteStore>(
|
const mutedFeed = useRequestBuilder<NoteCollection>(System, NoteCollection, sub);
|
||||||
System,
|
|
||||||
ParameterizedReplaceableNoteStore,
|
|
||||||
sub
|
|
||||||
);
|
|
||||||
|
|
||||||
const mutedList = useMemo(() => {
|
const mutedList = useMemo(() => {
|
||||||
if (pubkey && mutedFeed.data) {
|
if (pubkey && mutedFeed.data) {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
TaggedRawEvent,
|
TaggedRawEvent,
|
||||||
RelaySettings,
|
RelaySettings,
|
||||||
EventKind,
|
EventKind,
|
||||||
PubkeyReplaceableNoteStore,
|
NoteCollection,
|
||||||
RequestBuilder,
|
RequestBuilder,
|
||||||
} from "@snort/system";
|
} from "@snort/system";
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
@ -80,7 +80,7 @@ export default function useRelaysFeedFollows(pubkeys: HexKey[]): Array<RelayList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const relays = useRequestBuilder<PubkeyReplaceableNoteStore>(System, PubkeyReplaceableNoteStore, sub);
|
const relays = useRequestBuilder<NoteCollection>(System, NoteCollection, sub);
|
||||||
const notesRelays = relays.data?.filter(a => a.kind === EventKind.Relays) ?? [];
|
const notesRelays = relays.data?.filter(a => a.kind === EventKind.Relays) ?? [];
|
||||||
const notesContactLists = relays.data?.filter(a => a.kind === EventKind.ContactList) ?? [];
|
const notesContactLists = relays.data?.filter(a => a.kind === EventKind.ContactList) ?? [];
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import {
|
import { HexKey, Lists, EventKind, FlatNoteStore, NoteCollection, RequestBuilder } from "@snort/system";
|
||||||
HexKey,
|
|
||||||
Lists,
|
|
||||||
EventKind,
|
|
||||||
FlatNoteStore,
|
|
||||||
ParameterizedReplaceableNoteStore,
|
|
||||||
RequestBuilder,
|
|
||||||
} from "@snort/system";
|
|
||||||
import { useRequestBuilder } from "@snort/system-react";
|
import { useRequestBuilder } from "@snort/system-react";
|
||||||
|
|
||||||
import useLogin from "Hooks/useLogin";
|
import useLogin from "Hooks/useLogin";
|
||||||
@ -24,11 +17,7 @@ export default function useNotelistSubscription(pubkey: HexKey | undefined, l: L
|
|||||||
return rb;
|
return rb;
|
||||||
}, [pubkey]);
|
}, [pubkey]);
|
||||||
|
|
||||||
const listStore = useRequestBuilder<ParameterizedReplaceableNoteStore>(
|
const listStore = useRequestBuilder<NoteCollection>(System, NoteCollection, sub);
|
||||||
System,
|
|
||||||
ParameterizedReplaceableNoteStore,
|
|
||||||
sub
|
|
||||||
);
|
|
||||||
const etags = useMemo(() => {
|
const etags = useMemo(() => {
|
||||||
if (isMe) return defaultIds;
|
if (isMe) return defaultIds;
|
||||||
// there should only be a single event here because we only load 1 pubkey
|
// there should only be a single event here because we only load 1 pubkey
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import debug from "debug";
|
import debug from "debug";
|
||||||
import { unixNowMs, FeedCache } from "@snort/shared";
|
import { unixNowMs, FeedCache } from "@snort/shared";
|
||||||
import { EventKind, HexKey, SystemInterface, TaggedRawEvent, PubkeyReplaceableNoteStore, RequestBuilder } from ".";
|
import { EventKind, HexKey, SystemInterface, TaggedRawEvent, NoteCollection, RequestBuilder } from ".";
|
||||||
import { ProfileCacheExpire } from "./const";
|
import { ProfileCacheExpire } from "./const";
|
||||||
import { mapEventToProfile, MetadataCache } from "./cache";
|
import { mapEventToProfile, MetadataCache } from "./cache";
|
||||||
|
|
||||||
@ -94,8 +94,8 @@ export class ProfileLoaderService {
|
|||||||
MetadataRelays.forEach(r => fMissing.relay(r));
|
MetadataRelays.forEach(r => fMissing.relay(r));
|
||||||
}
|
}
|
||||||
const newProfiles = new Set<string>();
|
const newProfiles = new Set<string>();
|
||||||
const q = this.#system.Query<PubkeyReplaceableNoteStore>(PubkeyReplaceableNoteStore, sub);
|
const q = this.#system.Query<NoteCollection>(NoteCollection, sub);
|
||||||
const feed = (q?.feed as PubkeyReplaceableNoteStore) ?? new PubkeyReplaceableNoteStore();
|
const feed = (q?.feed as NoteCollection) ?? new NoteCollection();
|
||||||
// never release this callback, it will stop firing anyway after eose
|
// never release this callback, it will stop firing anyway after eose
|
||||||
const releaseOnEvent = feed.onEvent(async e => {
|
const releaseOnEvent = feed.onEvent(async e => {
|
||||||
for (const pe of e) {
|
for (const pe of e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user