mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 00:44:14 +00:00
fix: add delay to cipher text
This commit is contained in:
parent
87f64e6574
commit
4895a7266d
1 changed files with 4 additions and 2 deletions
|
|
@ -12,10 +12,12 @@ export function CipherText({ interval = 50, text }: CipherTextProps) {
|
|||
const [isMounted, setIsMounted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsMounted(true);
|
||||
setTimeout(() => setIsMounted(true), 2000);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isMounted) return;
|
||||
|
||||
let timer: NodeJS.Timeout;
|
||||
|
||||
if (outputText !== text) {
|
||||
|
|
@ -29,7 +31,7 @@ export function CipherText({ interval = 50, text }: CipherTextProps) {
|
|||
}
|
||||
|
||||
return () => clearInterval(timer);
|
||||
}, [text, interval, outputText]);
|
||||
}, [text, interval, outputText, isMounted]);
|
||||
|
||||
useEffect(() => {
|
||||
if (outputText === text) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue