Fix toast duplication in Community page
cgen-af386be49c38428e8eab4146b8121f97
This commit is contained in:
parent
52bf6f8bc2
commit
49b0583f95
1 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue