rm navigate

This commit is contained in:
smolgrrr 2024-01-06 15:20:28 +11:00
parent 97ea3f2219
commit 3203349573
2 changed files with 2 additions and 8 deletions

View File

@ -8,7 +8,6 @@ import { renderMedia } from "../../utils/FileUpload";
import { getIconFromHash, timeAgo } from "../../utils/cardUtils"; import { getIconFromHash, timeAgo } from "../../utils/cardUtils";
import { verifyPow } from "../../utils/mine"; import { verifyPow } from "../../utils/mine";
import { uniqBy } from "../../utils/otherUtils"; import { uniqBy } from "../../utils/otherUtils";
import { useNavigate } from 'react-router-dom';
interface CardProps { interface CardProps {
key?: string | number; key?: string | number;
@ -30,11 +29,10 @@ const PostCard = ({
const { files } = parseContent(event); const { files } = parseContent(event);
const icon = getIconFromHash(event.pubkey); const icon = getIconFromHash(event.pubkey);
const metadataParsed = metadata ? getMetadata(metadata) : null; const metadataParsed = metadata ? getMetadata(metadata) : null;
const navigate = useNavigate();
const handleClick = () => { const handleClick = () => {
if (type !== "OP") { if (type !== "OP") {
navigate(`/thread/${nip19.noteEncode(event.id)}`); window.location.href = `/thread/${nip19.noteEncode(event.id)}`;
} }
}; };

View File

@ -40,10 +40,6 @@ const Thread = () => {
// Call your subNote function or do whatever you need to do with id_to_hex // Call your subNote function or do whatever you need to do with id_to_hex
subNote(hexID, onEvent); subNote(hexID, onEvent);
} }
return () => {
// Your cleanup code here
};
}, [id]); // Empty dependency array means this useEffect runs once when the component mounts }, [id]); // Empty dependency array means this useEffect runs once when the component mounts
const uniqEvents = events.length > 0 ? uniqBy(events, "id") : []; const uniqEvents = events.length > 0 ? uniqBy(events, "id") : [];
@ -112,7 +108,7 @@ const Thread = () => {
const displayedEvents = sortByTime ? eventsSortedByTime : eventsSortedByPow; const displayedEvents = sortByTime ? eventsSortedByTime : eventsSortedByPow;
if (!uniqEvents[0]) { if (uniqEvents.length === 0) {
return ( return (
<Placeholder /> <Placeholder />
); );