Skip to content

Commit

Permalink
feat: add cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
ppbl authored Dec 18, 2024
1 parent 3599871 commit 6831da6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/useXChat/demo/stream-cancel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const App = () => {

const abortRef = useRef(() => {});

useEffect(() => {
return () => {
abortRef.current();
};
}, []);

// Agent for request
const [agent] = useXAgent({
request: async ({}, { onSuccess, onUpdate }) => {
Expand Down

0 comments on commit 6831da6

Please sign in to comment.