Add ref guard to prevent duplicate toast calls
cgen-96d5fe7b5c8849eeb5f87d4c379afb31
This commit is contained in:
parent
bf6d49e491
commit
1cd9cb4e32
1 changed files with 5 additions and 1 deletions
|
|
@ -24,11 +24,15 @@ import {
|
||||||
export default function Documentation() {
|
export default function Documentation() {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [searchQuery, setSearchQuery] = useState("");
|
const [searchQuery, setSearchQuery] = useState("");
|
||||||
|
const toastShownRef = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
aethexToast.system("Documentation center loaded");
|
if (!toastShownRef.current) {
|
||||||
|
aethexToast.system("Documentation center loaded");
|
||||||
|
toastShownRef.current = true;
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue