question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

browsersync reloads the browser when connection is restored (even though it doesn't need to reload)

See original GitHub issue

Issue details

When a page has a high load (eg it takes 30 seconds to render) browsersync will have lost it’s connection and on reconnect it refreshes, this keeps on going until the server is stopped

Steps to reproduce/test case

use browsersync, make a page do some heavy lifting for 30 seconds then watch as the page keeps refreshing just after crunching for a while

Please specify which version of Browsersync, node and npm you’re running

  • Browsersync [ 2.24.6 ]
  • Node [ 8.11.4 ]
  • Npm [ 5.6.0 ]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (android on samsung galaxy tab 3)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

If CLI, please paste the entire command below

{cli command here}

for all other use-cases, (gulp, grunt etc), please show us exactly how you’re using Browsersync

  browserSync
    .init({
      server: distDir,
      ghostMode: false,
      reloadOnRestart: false,
      port: params.port || config.browserSyncPort || 3000,
      open: (typeof params.openBrowser === 'boolean') && params.openBrowser || config.openBrowser || false,
      middleware: function (req, res, cb) {
        // When using multiple languages, the root does not contain html files
        if (hasMultipleLocales && req.url === '/') {
          res.writeHead(302, { 'Location': `/${config.defaultLanguage || 'en'}/` });
          res.end();
          req.url = `/${config.defaultLanguage || 'en'}/`;
          return;
        }

        if (req.url.indexOf('.') > -1) {
          return cb();
        }

        const uri = url.parse(req.url);

        if (
          uri.pathname.length > 1
          && path.extname(uri.pathname) === ''
          && fs.existsSync(path.join(distDir, uri.pathname + '.html'))
        ) {
          req.url = uri.pathname + '.html' + (uri.search || '');
        }

        cb();
      }
    });

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
shakyShanecommented, Oct 6, 2018

fixed in browser-sync-client@2.26.0 😃

1reaction
gama410commented, Aug 28, 2018

I noticed the same thing starting with 2.24.5 also! For me, it would appear when staying on any breakpoint longer than heartbeatTimeout… Changing the timeout value indeed helped…

I find it strange that the problem didn’t occur prior to 2.24.5, actually…

Read more comments on GitHub >

github_iconTop Results From Across the Web

browsersync does not reload when there are changes in .css
scss to .css it does not do anything. As you can see I have 2 consoles, 1 executes gulp (to compile sass) and...
Read more >
Browsersync options
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >
BrowserSync not refreshing - Laracasts
BrowserSync not refreshing. For some reason I can't get BrowserSync to refresh when I update my files. Upon running gulp watch the connection...
Read more >
BrowserSync keeps reloading infinitely upon JavaScript ...
After many times of getting it to work, given the many different errors I've gotten (infinite reloading on browser, ignoring scss changes, ignoring...
Read more >
If your iCloud or Safari bookmarks aren't syncing - Apple Support
For example, if you need to access a bookmark that you accidentally deleted or make changes in your web browser that don't update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found