From 52bf6f8bc27a99b1526d8cbbbf7812010393b661 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 5 Aug 2025 23:38:25 +0000 Subject: [PATCH] Fix toast duplication in Blog page cgen-e87fef4a528f4597bf6c89f067193834 --- client/pages/Blog.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/pages/Blog.tsx b/client/pages/Blog.tsx index 0a475f36..e89da0fd 100644 --- a/client/pages/Blog.tsx +++ b/client/pages/Blog.tsx @@ -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"; @@ -23,11 +23,15 @@ import { export default function Blog() { const [isLoading, setIsLoading] = useState(true); const [selectedCategory, setSelectedCategory] = useState("all"); + const toastShownRef = useRef(false); useEffect(() => { const timer = setTimeout(() => { setIsLoading(false); - aethexToast.system("AeThex Blog loaded successfully"); + if (!toastShownRef.current) { + aethexToast.system("AeThex Blog loaded successfully"); + toastShownRef.current = true; + } }, 1000); return () => clearTimeout(timer);