bug: thread sub loop

This commit is contained in:
2023-01-21 16:18:44 +00:00
parent d66f9ab18d
commit bd2417cda0
2 changed files with 9 additions and 4 deletions

View File

@ -13,8 +13,13 @@ export default function useThreadFeed(id: u256) {
function addId(id: u256[]) { function addId(id: u256[]) {
setTrackingEvent((s) => { setTrackingEvent((s) => {
let tmp = new Set([...s, ...id]); let orig = new Set(s);
return Array.from(tmp); if (!id.some(a => orig.has(a))) {
let tmp = new Set([...s, ...id]);
return Array.from(tmp);
} else {
return s;
}
}) })
} }
@ -45,5 +50,5 @@ export default function useThreadFeed(id: u256) {
return () => clearTimeout(t); return () => clearTimeout(t);
}, [main.store]); }, [main.store]);
return main; return main.store;
} }

View File

@ -8,5 +8,5 @@ export default function EventPage() {
const id = parseId(params.id!); const id = parseId(params.id!);
const thread = useThreadFeed(id); const thread = useThreadFeed(id);
return <Thread notes={thread.store.notes} this={id} />; return <Thread notes={thread.notes} this={id} />;
} }