Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome refreshing after breakpoint (break point) pause #143

Closed
zatchgordon opened this issue Aug 16, 2018 · 4 comments
Closed

Chrome refreshing after breakpoint (break point) pause #143

zatchgordon opened this issue Aug 16, 2018 · 4 comments

Comments

@zatchgordon
Copy link

zatchgordon commented Aug 16, 2018

Chrome refreshing after breakpoint (break point) pause

When pausing on a break point via a the chrome debugger or via vs code and waiting more than 5 seconds (normally just inspecting an variable) and then continuing the code, chrome will refresh. I would expect chrome to not refresh and continue on with the code. The weird thing is if i continue the breakpoint immediately then chrome will not refresh. It's only when a breakpoint is stopped for and elongated period of time (5-20 seconds) that chrome will refresh.

The problem might have to do sort of with Chrome, but I've tried with IIS/visual studio and the same problem does NOT occur leading me to think it is a mix of lite-server/browsersync/chrome.

I have tried setting the browsersync settings of "watch": false "files": [""] "files": ["index.html"] but none of those seem to stop Chrome from refreshing when paused at a breakpoint for a more than a few seconds.

Bug repro steps

Here are my normal settings and edited (trying to make the refresh not happen) settings for browsersync for running with lite-server -c bsSettings.config.js

Normal settings

module.exports = {    
    "port": 44300,
    "https": true,
    "files": ["./**/*.{html,htm,css,js,ts}"],
    "server": { "baseDir": "./" },
    "open": false
}; 

New settings trying to stop the bug from happening

module.exports = {
    "port": 44300,
    "https": true,
    "files": ["index.html"],
    // "server": { "baseDir": "./" },
    // "open": false,
    watch: false,
}; 
  1. Run the command lite-server -c bsSettings.config.js
  2. Open Chrome (if not opened by default)
  3. Open chrome console
  4. Go to Sources tab
  5. Find a file to set a breakpoint on
  6. Set a breakpoint
  7. Navigate app to trigger breakpoint
  8. Wait 5, 10, 15 seconds on breakpoint
  9. Un-pause breakpoint
  10. Chrome Refreshes

Environment

  • lite-server version: 2.4.0
  • nodejs version: 10.5.0
  • npm version: 6.1.0
  • OS type/version: Windows 10
@fractionalJoe
Copy link

+1

1 similar comment
@matsakyan
Copy link

+1

@royalrex
Copy link

royalrex commented Sep 20, 2018

I have the same issue, but I don't use lite-server. I found this issue when searching for "stop chrome from reloading after breakpoint".
After further testing, I have found that the same issue is true in Firefox, so it might be a browsersync issue.
For reference I use gulp serve for development, and it triggers this issue.

EDITED: Okay, there is an open issue about this thing: BrowserSync/browser-sync#1591 (comment)

Work around this "bug" by adding this setting:

browserSync.init({
...
    socket: {
        clients: { heartbeatTimeout: 60000 } 
    }
...
});

@zatchgordon
Copy link
Author

If setting heartbeatTimeout doesn't work... you can run

npm i -D -E browser-sync@2.23.7

as mentioned in the thread roayalrex mentioned.

This worked for me.
Marking as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants