Infinite loading when refreshing the page in NextJS
See original GitHub issueDescribe the bug
Hello @kettanaito I add msw to nextjs with server side rendering, which make hot reloading in Nextjs not work.
I tested and saw that at my local, when editting code then waiting it display on screen, but not. I have to Ctrl + f5. If it’s lucky it will show up, otherwise the machine will hang with the words ‘waiting for existing socket’ .
But when I close tab and open new tab, it’s ok, But that’s really inconvenient, if I comment require(‘…/mocks’) in _app.js file. It’s oke
Environment
msw: 0.26.1
nodejs: 12.18.2
npm: 6.14.5
Version chrome: 88.0.4324.104
To Reproduce
Link repo: https://codesandbox.io/s/serverless-fog-mex0z?file=/package.json:352-358
Screenshots
If applicable, add screenshots to help explain your problem.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Next.js - Loading doesn't turn off when refreshing page
It works just fine unless I refresh the page. The loading doesn't become 0 (false) when I refresh the page. When I change...
Read more >Basic Features: Fast Refresh - Next.js
Next.js ' Fast Refresh is a new hot reloading experience that gives you instantaneous feedback on edits made to your React components.
Read more >Fetch data from Next.js API and create an infinite loading list ...
Check out https://screencasts.alterclass.io/ for more episodes!▻ Learn to build your own production-ready React applications and become a ...
Read more >500 Internal Server Error, using Next.js Causing Refresh ...
On the / page it's just not loading anything from our app. So weird and getting these errors on the console.
Read more >location.reload() - Web APIs | MDN
You may, though, come across instances of location.reload(true) in existing code that was written with the assumption the force-reload effect ...
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
I don’t think this is fully fixed. I’m seeing infinite refresh behavior in my own next.js app, same as I was seeing in the OP’s sandbox. My app uses msw v0.28.1, so I forked the OP’s sandbox and updated to the latest msw, v0.28.2, and still see this behavior.
Environment
msw: 0.28.2 nodejs: 12.18.2 npm: 6.14.6
Chrome: 89.0.4389.114
To Reproduce
Code Sandbox: https://codesandbox.io/s/busy-water-u8u1d Standalone web view: https://u8u1d.sse.codesandbox.io/
Open the Chrome dev tools and refresh the result web view pane and it may go into an infinite refresh loop. You will definitely see the loop if you open the standalone web view in a new window.
This is how I have my dev tools configured:
It’s entirely possible I’m simply doing service workers wrong, but if so, please provide some documentation on how the dev tools should be configured for working with msw.
Happy to open a new ticket if necessary.
lmao i got this infinite loop while running in the server side using Next.JS with graphql, i solved it by removing unecessary data that outside the requested query, and it solve my infinite loop.