Static GitHub Issues

[3072] Loading indicator also visible in ssr

prev: Google crawler parses empty DOM with SSR
next: Feature req: config option to disable pretty output

Hey! Minor but crazy but here 😄 I make this conditional mode rendering:

  serverMiddleware: [{
    handler(req, res, next) {
      let isBot = crawlersRegex.test(req.headers['user-agent'])
      res.spa = !isBot
      next()
    }
  }]

Sometimes (maybe when server is slow) the loading indicator will also be visible when there is a bot user agent. In practice google crawls my page and only the loading indicator is visible.

If I always have res.spa = false the bug will not appear. It appears only then the spa can change. Potentially some caching in the nuxt cure from the last request?

Reproduce:

Chome with GoogleBot user agent. Open the element inspector. Hit refresh (repeat only after a full page load, repeat until the issue appears). Sometimes the loading indicator will be visible for few millis even if all requests are made with a GoogleBot user agent (aka spa=false).

Workaround:

loadingIndicator: false

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2659">#c2659</a>)</em></sub></div>