Static GitHub Issues

[714] When routing is switched, the component will be rendered two times

prev: Can't find generated files
next: npm build error

Nuxt version: latest(0.10.7)

Some of my project structures are like this:

image

layout1:

<div>
    <nuxt :key="$route.path"/>
  </div>

layout2:

<div>
    <nuxt />
  </div>

page1:

export default {
   layout: 'layout1'
}

page2:

export default {
  layout: 'layout2',
  created () {
    console.log('Page2 is created')
  },
  mounted () {
    console.log('Page2 is mounted')
  }
}

If I switch from route page1 to page2, the page2 will be rendered two times

image

I guess the key in page1 caused this problem

If I remove the key from page1, the render becomes normal

<!--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/c608">#c608</a>)</em></sub></div>