From 32033495736ac3afdd9f74b69c925bde9e3c7caa Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Sat, 6 Jan 2024 15:20:28 +1100 Subject: [PATCH] rm navigate --- client/src/components/Modals/NoteCard.tsx | 4 +--- client/src/components/Thread.tsx | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/client/src/components/Modals/NoteCard.tsx b/client/src/components/Modals/NoteCard.tsx index 071b919..c7bc431 100644 --- a/client/src/components/Modals/NoteCard.tsx +++ b/client/src/components/Modals/NoteCard.tsx @@ -8,7 +8,6 @@ import { renderMedia } from "../../utils/FileUpload"; import { getIconFromHash, timeAgo } from "../../utils/cardUtils"; import { verifyPow } from "../../utils/mine"; import { uniqBy } from "../../utils/otherUtils"; -import { useNavigate } from 'react-router-dom'; interface CardProps { key?: string | number; @@ -30,11 +29,10 @@ const PostCard = ({ const { files } = parseContent(event); const icon = getIconFromHash(event.pubkey); const metadataParsed = metadata ? getMetadata(metadata) : null; - const navigate = useNavigate(); const handleClick = () => { if (type !== "OP") { - navigate(`/thread/${nip19.noteEncode(event.id)}`); + window.location.href = `/thread/${nip19.noteEncode(event.id)}`; } }; diff --git a/client/src/components/Thread.tsx b/client/src/components/Thread.tsx index 7a4b3ac..4047e8e 100644 --- a/client/src/components/Thread.tsx +++ b/client/src/components/Thread.tsx @@ -40,10 +40,6 @@ const Thread = () => { // Call your subNote function or do whatever you need to do with id_to_hex subNote(hexID, onEvent); } - - return () => { - // Your cleanup code here - }; }, [id]); // Empty dependency array means this useEffect runs once when the component mounts const uniqEvents = events.length > 0 ? uniqBy(events, "id") : []; @@ -112,7 +108,7 @@ const Thread = () => { const displayedEvents = sortByTime ? eventsSortedByTime : eventsSortedByPow; - if (!uniqEvents[0]) { + if (uniqEvents.length === 0) { return ( );