Nuxt.js: Error page causes layout components mount twice

Created on 11 Feb 2020  路  7Comments  路  Source: nuxt/nuxt.js

Version

v2.11.0

Reproduction link

https://codesandbox.io/s/mounted-twice-error-page-f2qvy

Steps to reproduce

  1. watch Console and see 'LOGO MOUNTED IN LAYOUT' from ~/components/Logo.vue used in ~/layouts/default.vue
  2. click on 'error' link
  3. observe 'LOGO MOUNTED IN LAYOUT' from Logo.vue again
  4. navigate to any links and see no more messages

What is expected ?

'LOGO MOUNTED IN LAYOUT' message only once in console, because layout is not changing

What is actually happening?

'LOGO MOUNTED IN LAYOUT' message is shown twice, when visiting error page

Additional comments?

no such bug in 2.7.1 for example

bug-report

All 7 comments

Sorry for the delay @gerasimvol

When I go to https://f2qvy.sse.codesandbox.io/asdasdasd, I only see the log once in the console.

@Atinux I think it's because sandbox uses old nuxt version
I have locked nuxt to 2.11.0 - bug is present now

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

bug is still present, even in v2.12.0
issue description is relevant and seems that not only error page cause layout rerender. other custom layouts too

Workaround found: https://github.com/nuxt/nuxt.js/issues/5703#issuecomment-603969605

Fixed sandbox (until next release of Nuxt): https://codesandbox.io/s/mounted-twice-error-page-qt672

Nuxt V2.12.1 is released with the fix 馃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bimohxh picture bimohxh  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

surmon-china picture surmon-china  路  3Comments

vadimsg picture vadimsg  路  3Comments