mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-05 05:12:38 +02:00
close eventsource on chat unmount
This commit is contained in:
parent
2c3016f143
commit
eac001527c
1 changed files with 10 additions and 0 deletions
|
|
@ -160,6 +160,16 @@ export function Chat({
|
|||
setIsLastInteracted(true);
|
||||
}
|
||||
|
||||
// clean up event source on component unmount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (eventSourceRef.current) {
|
||||
eventSourceRef.current.close();
|
||||
eventSourceRef.current = null;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const container = scrollContainerRef.current;
|
||||
if (!container) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue