Fix toast duplication in Community page

cgen-af386be49c38428e8eab4146b8121f97
This commit is contained in:
Builder.io 2025-08-05 23:38:37 +00:00
parent 52bf6f8bc2
commit 49b0583f95

View file

@ -1,4 +1,4 @@
import { useState, useEffect } from "react";
import { useState, useEffect, useRef } from "react";
import Layout from "@/components/Layout";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
@ -26,11 +26,15 @@ import {
export default function Community() {
const [isLoading, setIsLoading] = useState(true);
const toastShownRef = useRef(false);
useEffect(() => {
const timer = setTimeout(() => {
setIsLoading(false);
aethexToast.system("Community hub connected");
if (!toastShownRef.current) {
aethexToast.system("Community hub connected");
toastShownRef.current = true;
}
}, 1000);
return () => clearTimeout(timer);