Using MSW with Next.js causes stopping HMR/Fast Refresh
See original GitHub issueDescribe the bug
Using MSW with Next.js causes stopping HMR/Fast Refresh because of unclosed SSE connections.
Environment
msw: 0.26.2
nodejs: 14.14.0
yarn: 2.4.1
Browser: Chromium 89.0.4389.82
To Reproduce
Steps to reproduce the behavior:
- Clone https://github.com/tkamenoko/msw-nextjs-hmr .
- Install deps:
yarn
. - Start dev server:
yarn dev
. - Open
localhost:3000
in your browser. - Show
Network
tab in DevTools. - Click rendered links, and you will find that SSE connections between MSW and the dev server are not closed.
- After the number of connections reaches the limit, HMR will not work.
- Reload the page, but it will not complete:
Waiting for available sockets
Expected behavior
A browser should receive changes and refresh the page. SSE connections between MSW and the dev server should be closed when connections between browser and MSW are closed.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Fearless demos, controlled tests: Next.js & MSW tutorial
Take your demos and tests to the next level, by bringing in Mock Service Worker!Are you nervous doing live demos because you always...
Read more >How to mock server responses in useEffect using MSW.js (5/6)
NextJS & Tests : How to mock server responses in useEffect using MSW.js (5/6). Watch later. Share. Copy link. Info. Shopping. Tap to...
Read more >Next.js : Refresh page after modifying a file, without rerunning ...
I have to stop the npm script, rerun the "npm run xxx" command, then refresh the browser. It's kind of time consuming. Is...
Read more >A curated list of awesome things related to Vite.js - Morioh
In this library, we will learn about Awesome Vite.js: A Curated List Of Awesome ... Redux Toolkit, RTK Query, TailwindCSS, MSW, Jest, React...
Read more >Full text of "Mount Sinai Journal of Medicine" - Internet Archive
The leading reasons for using the emergency response system were falls and chest ... even further the promotion of health as a means...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having the same Issue
@kettanaito I think what @tkamenoko and I mean is that this issue is tracking HMR issue, not the solved cookies issue which maybe not related to this one.😂 So we can still discuss here.
I’ve created a simpler repo to reproduce the issue: https://github.com/saintwinkle/with-msw-next-app .
And here’s the process:
https://user-images.githubusercontent.com/4580163/112440392-3720df00-8d85-11eb-9646-9b8df73879ef.mov
If i’m missing something, let me know. Thanks!