Skip to content

react-router request signal not relyable #13601

Open
@lauhon

Description

@lauhon

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

  1. Open Stackblitz https://stackblitz.com/edit/github-mv51fdvk?file=app%2Froutes%2Fhome.tsx

  2. Start in dev mode (or producation - bug is also there)

  3. Visit preview to receive server-sent events on

  • / - custom Stream implementation
  • /remix-utils - eventStream using remix-utils
  1. 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

  1. Log output
  2. 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions