We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4dbdea commit 2476619Copy full SHA for 2476619
1 file changed
packages/ui-components/src/hooks/use-typing-animation.ts
@@ -18,6 +18,7 @@ export function useTypingAnimation({
18
const prevIsDefaultRef = useRef(isDefault);
19
20
useEffect(() => {
21
+ let interval: NodeJS.Timeout | undefined;
22
const shouldAnimate =
23
prevChatIdRef.current === chatId &&
24
prevIsDefaultRef.current === true &&
@@ -26,7 +27,7 @@ export function useTypingAnimation({
26
27
if (shouldAnimate && text.length > 0) {
28
setDisplayedText('');
29
let currentIndex = 0;
- const interval = setInterval(() => {
30
+ interval = setInterval(() => {
31
if (currentIndex < text.length) {
32
setDisplayedText(text.slice(0, currentIndex + 1));
33
currentIndex++;
0 commit comments