import { unstable_cache as cache } from "next/cache"; import Image from "next/image"; import { EmbeddedTweet, TweetNotFound } from "react-tweet"; import { fetchTweet as _fetchTweet } from "react-tweet/api"; import { cn } from "@/lib/utils"; const fetchTweet = cache(_fetchTweet, undefined, { revalidate: false, // cache indefinitely tags: ["tweet"], }); const Tweet = async ({ id, className }: { id: string; className?: string }) => { try { const { data } = await fetchTweet(id); return (
{data ? ( , // eslint-disable-next-line jsx-a11y/alt-text MediaImg: (props) => , }} /> ) : ( )}
); } catch (error) { console.error(error); return (
); } }; export default Tweet;