abort stream when conversationId updates

This commit is contained in:
“Shriya
2024-08-21 05:50:04 +05:30
parent 3c683f2192
commit 24d6889b24

View File

@@ -54,13 +54,9 @@ export default function Conversation() {
}
}, []);
useEffect(() => {
return () => {
if (status !== 'idle') {
fetchStream.current && fetchStream.current.abort(); //abort previous stream
}
};
}, [status]);
useEffect(()=>{
fetchStream.current && fetchStream.current.abort();
},[conversationId]);
useEffect(() => {
const observerCallback: IntersectionObserverCallback = (entries) => {