Skip to content

Commit 03c0259

Browse files
committed
fix: animation fade-out
1 parent 7302cdd commit 03c0259

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

examples/react-chatbot/components/AIChatApp/AIChatApp.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,15 @@ export const AIChatApp = ({
117117

118118
// Handle fade-out when both conditions are met
119119
useEffect(() => {
120-
if (chatClient && minTimeElapsed && !isFadingOut) {
121-
// Start fade-out animation
122-
setIsFadingOut(true);
123-
124-
// Remove loading screen after animation completes (400ms)
125-
const fadeOutTimer = setTimeout(() => {
126-
setShowLoadingScreen(false);
127-
}, 400);
128-
129-
return () => clearTimeout(fadeOutTimer);
130-
}
131-
}, [chatClient, minTimeElapsed, isFadingOut]);
120+
if (!minTimeElapsed) return;
121+
setIsFadingOut(true);
122+
// Remove loading screen after animation completes (400ms)
123+
const fadeOutTimer = setTimeout(() => {
124+
setShowLoadingScreen(false);
125+
}, 400);
126+
127+
return () => clearTimeout(fadeOutTimer);
128+
}, [minTimeElapsed]);
132129

133130
return (
134131
<div className="ai-demo-app">

0 commit comments

Comments
 (0)