import { cacheLife, cacheTag } from "next/cache"; import Image from "next/image"; import { EmbeddedTweet, TweetNotFound } from "react-tweet"; import type { Tweet as TweetType } from "react-tweet/api"; import { fetchTweet } from "react-tweet/api"; import { cn } from "@/lib/utils"; const Tweet = async ({ id, className }: { id: string; className?: string }) => { "use cache"; cacheLife("max"); cacheTag("tweet", `tweet-${id}`); let data: TweetType | undefined; try { const result = await fetchTweet(id); data = result?.data; } catch (error) { console.error(error); } if (!data) { return (
); } return (
, // oxlint-disable-next-line jsx-a11y/alt-text, react/no-unstable-nested-components MediaImg: (props) => , }} />
); }; export { Tweet };