Skip to content

MSW stops handling requests after 5 mins in page hidden state #2635

Description

@psea

Prerequisites

Environment check

  • I'm using the latest msw version
  • I'm using Node.js version 20 or higher

Browsers

Chromium (Chrome, Brave, etc.)

Reproduction repository

https://github.com/psea/msw-hidden-timeout

Reproduction steps

Test app with steps to reproduce is deployed here:
https://psea.github.io/msw-hidden-timeout/

  1. ✅ Check the status of the MSW. See the response.
  2. ⚠️ Close developer tools if open.
  3. 💤 Minimize the window or switch the tab.
  4. ⏳ Wait 5 min before restoring the window.
  5. ❌ Check the status of the MSW again. See the error.
  6. ⛑️ Click the "🔧 Fix MSW" button to restore the mocking.
  7. ✅ Check the status of the MSW again. See the response restored.

Current behavior

MSW stops handling requests after page is in a hidden state for 5 min.

Expected behavior

MSW continue handling requests after page become visible.

Related

Duplicate of #2115

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds:triageIssues that have not been investigated yet.scope:browserRelated to MSW running in a browser

    Type

    No type

    Fields

    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