import type { AnyPostFragment } from "@hey/indexer"; import type { ComponentProps, ReactNode } from "react"; import { memo } from "react"; import { Link } from "react-router"; import { usePostLinkStore } from "@/store/non-persisted/navigation/usePostLinkStore"; interface PostLinkProps extends Omit, "to"> { post: AnyPostFragment; children: ReactNode; } const PostLink = ({ post, children, onClick, ...props }: PostLinkProps) => { const { setCachedPost } = usePostLinkStore(); return ( { setCachedPost(post); onClick?.(e); }} > {children} ); }; export default memo(PostLink);