From 0ef6dd27b4c516c6948e8107c9e2477fca9f069f Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Fri, 6 Dec 2024 11:02:51 +0700 Subject: update performance --- src-migrate/modules/popup-information/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx index 5acdb068..d50711cc 100644 --- a/src-migrate/modules/popup-information/index.tsx +++ b/src-migrate/modules/popup-information/index.tsx @@ -5,6 +5,7 @@ import Image from 'next/image'; import Link from 'next/link'; import { Modal } from '~/components/ui/modal'; import { getAuth } from '~/libs/auth'; +import dynamic from 'next/dynamic'; const PagePopupInformation = () => { const router = useRouter(); @@ -12,6 +13,8 @@ const PagePopupInformation = () => { const auth = getAuth(); const [active, setActive] = useState(false); const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + useEffect(() => { const getData = async () => { @@ -20,6 +23,7 @@ const PagePopupInformation = () => { if (data) { setData(data); } + setLoading(false); }; if (isHomePage && !auth) { @@ -29,7 +33,7 @@ const PagePopupInformation = () => { }, [isHomePage, auth]); return (
- {data && ( + {data && !loading && (