Fix toast duplication in MentorshipPrograms page
cgen-5297facaeda740cfba6e2bc49822ff2b
This commit is contained in:
parent
65fbe2250b
commit
95dd042e06
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 Layout from "@/components/Layout";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
|
|
@ -32,10 +32,15 @@ export default function MentorshipPrograms() {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [selectedTrack, setSelectedTrack] = useState(0);
|
const [selectedTrack, setSelectedTrack] = useState(0);
|
||||||
|
|
||||||
|
const toastShownRef = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
aethexToast.system("Mentorship Programs loaded successfully");
|
if (!toastShownRef.current) {
|
||||||
|
aethexToast.system("Mentorship Programs loaded successfully");
|
||||||
|
toastShownRef.current = true;
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue