Fix toast duplication in ResearchLabs page
cgen-d7e8aa3cb8cb497fb9d8c2346db384d0
This commit is contained in:
parent
95dd042e06
commit
1bf4020b65
1 changed files with 7 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,10 +26,15 @@ import {
|
|||
export default function ResearchLabs() {
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const toastShownRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setIsLoading(false);
|
||||
aethexToast.system("Research & Labs division accessed");
|
||||
if (!toastShownRef.current) {
|
||||
aethexToast.system("Research & Labs division accessed");
|
||||
toastShownRef.current = true;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue