Skip to content

HMR Update is not applying when network is taking time #14906

@AviVahl

Description

@AviVahl

Reproduction

We've had this issue in our production environment, which uses react-router as a template for new projects.
We were unable to reproduce it at first... but then we found out that if we simulate a slower network locally, it reproduces quite consistently.

See attached video:

Screencast.From.2026-03-22.17-55-20.mp4

You can test the same yourself at https://github.com/AviVahl/react-router-hmr-issue

System Info

System:
    OS: Linux 6.19 Fedora Linux 43 (Workstation Edition)
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
    Memory: 56.28 GB / 62.47 GB
    Container: Yes
    Shell: 5.3.0 - /bin/bash
  Binaries:
    Node: 24.14.0 - /home/avi/.nvm/versions/node/v24.14.0/bin/node
    npm: 11.9.0 - /home/avi/.nvm/versions/node/v24.14.0/bin/npm
  Browsers:
    Chrome: 146.0.7680.153
    Firefox: 148.0.2
    Firefox Developer Edition: 148.0.2
  npmPackages:
    @react-router/dev: ^7.13.1 => 7.13.1 
    @react-router/node: ^7.13.1 => 7.13.1 
    @react-router/serve: ^7.13.1 => 7.13.1 
    react-router: ^7.13.1 => 7.13.1 
    vite: ^7.1.7 => 7.3.1

Used Package Manager

npm

Expected Behavior

HMR updates should always apply if they come in.

Actual Behavior

When network is slow enough, some updates do not apply if they come in succession. They do reach the client, but the client doesn't apply them.

I'm guessing there is some "already in the middle of an update" mutex behavior causing the update to not apply.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions