content/docs/09-troubleshooting/15-abort-breaks-resumable-streams.mdx
When using useChat with resume: true for stream resumption, the abort functionality breaks. Closing a tab, refreshing the page, or calling the stop() function will trigger an abort signal that interferes with the resumption mechanism, preventing streams from being properly resumed.
// This configuration will cause conflicts
const { messages, stop } = useChat({
id: chatId,
resume: true, // Stream resumption enabled
});
// Closing the tab will trigger abort and stop resumption
When a page is closed or refreshed, the browser automatically sends an abort signal, which breaks the resumption flow.
We're aware of this incompatibility and are exploring solutions. In the meantime, please choose either stream resumption or abort functionality based on your application's requirements, but not both.
If you need to support long-running generations that persist across page reloads:
const { messages, sendMessage } = useChat({
id: chatId,
resume: true,
});
If you need to allow users to stop streams manually:
const { messages, sendMessage, stop } = useChat({
id: chatId,
resume: false, // Disable stream resumption (default behavior)
});