Open
Description
I'm using React Router as a...
framework
Context
I am building a loader function that returns a Stream Response to push information to the frontend in an interval as long as the connection is active. Keyword SSE (Server sent events)
Im getting inspiration from remix-utils and mdn
Reproduction
-
Open Stackblitz https://stackblitz.com/edit/github-mv51fdvk?file=app%2Froutes%2Fhome.tsx
-
Start in dev mode (or producation - bug is also there)
-
Visit preview to receive server-sent events on
- / - custom Stream implementation
- /remix-utils - eventStream using remix-utils
- Close open tabs and inspect logs
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@react-router/dev: ^7.5.3 => 7.6.0
@react-router/node: ^7.5.3 => 7.6.0
@react-router/serve: ^7.5.3 => 7.6.0
react-router: ^7.5.3 => 7.6.0
vite: ^6.3.3 => 6.3.5
Used Package Manager
npm
Expected Behavior
When closing the tab the abort event should be triggered resulting in
- Log output
- a stop in the interval execution
Actual Behavior
When closing the tab the abort event is not triggered so the loop is continuing to run on both routes (/ and /remix-utils)