diff --git a/src/components/site/Platform.tsx b/src/components/site/Platform.tsx index b53a20bc..47543b2f 100644 --- a/src/components/site/Platform.tsx +++ b/src/components/site/Platform.tsx @@ -1,5 +1,6 @@ "use client" +import { useDebounceEffect } from "ahooks" import { useEffect, useState } from "react" import { Tooltip } from "~/components/ui/Tooltip" @@ -172,9 +173,19 @@ export const Platform = ({ className?: string }) => { platform = platform.toLowerCase() - let link = PlatformsSyncMap[platform]?.url - switch (platform) { + const [debouncePlatform, setDebouncePlatform] = useState(platform) + useDebounceEffect( + () => { + setDebouncePlatform(platform) + }, + [platform], + { wait: 500 }, + ) + + let link = PlatformsSyncMap[debouncePlatform]?.url + + switch (debouncePlatform) { case "mastodon": case "misskey": case "pleroma": @@ -190,7 +201,7 @@ export const Platform = ({ useEffect(() => { setShowImg(true) - }, [platform]) + }, [debouncePlatform]) return ( {showImg ? ( // eslint-disable-next-line @next/next/no-img-element {platform} setShowImg(false)}