T
TanStack3mo ago
optimistic-gold

SSE background Fetching while component unmount

So I am using react query to receiving streaming SSE api. The problem is this stream should not be canceled or stoped until a manual stop button is clicked. How can I make fetch SSE and complete it even though the component is unmounted? React query’s default behavior is canceling the quey if component is unmountrd. For the stop button, I am using query’s signal, but this makes react query to stop the streaming when component unmounted
1 Reply
blank-aquamarine
blank-aquamarine3mo ago
don't use our signal, use your own.

Did you find this page helpful?