Add ref guard to prevent duplicate toast calls

cgen-96d5fe7b5c8849eeb5f87d4c379afb31
This commit is contained in:
Builder.io 2025-08-05 23:38:07 +00:00
parent bf6d49e491
commit 1cd9cb4e32

View file

@ -24,11 +24,15 @@ import {
export default function Documentation() {
const [isLoading, setIsLoading] = useState(true);
const [searchQuery, setSearchQuery] = useState("");
const toastShownRef = useRef(false);
useEffect(() => {
const timer = setTimeout(() => {
setIsLoading(false);
aethexToast.system("Documentation center loaded");
if (!toastShownRef.current) {
aethexToast.system("Documentation center loaded");
toastShownRef.current = true;
}
}, 1000);
return () => clearTimeout(timer);