nuxt: Wrong layoutName

Version

v2.13.0

Reproduction link

https://u1rpq.sse.codesandbox.io/

Steps to reproduce

Go to an error page (ex: https://u1rpq.sse.codesandbox.io/not-found), open your debug console, click on home link, see wrong layout. Do hard refresh (F5), layoutName is good now (SSR ok)… It can be related to https://github.com/nuxt/nuxt.js/issues/5703, https://github.com/nuxt/nuxt.js/issues/7554

What is expected ?

layoutName should be : front

What is actually happening?

layoutName value is: default, it displays default layout instead of front layout

Additional comments?

I use layoutName in order to stylize, it’s a very big issue which break all my app… I’m missing something ?

<div align="right">This bug report is available on Nuxt community (#c10812)</div>

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 22 (6 by maintainers)

Most upvoted comments

@usb248 thanks for the report, I’m looking into it.

Hi. This should be (finally) fixed with v2.13.2 apologizes for all inconveniences due to this bug.

Bug still exists. The issue is that setLayout from App:render is being called for error layout when navigating from404 to / (last console log)

image

We are working to find a fix 😃

Let’s closed when v2.13.1 lands, I am really sorry about this regression 😬

Hey, here is my temporal workaround to handle this issue. In your error.vue layout put

<script>
  export default {
    name: 'error',
    layout: 'empty',
    beforeDestroy() {
      $nuxt.setLayout('default') // this line is basically the 'fix'
    },
  };
</script>

Agree, that’s not a great solution, but if this bug is critical for you it should work fine until it’s fixed.

https://codesandbox.io/s/prod-forest-319td?file=/layouts/error.vue

@Atinux, when error page uses the default layout and Home, About use the front layout, it works as expected. Reproduction at https://codesandbox.io/s/pensive-glade-hkpfl. So it looks that the issue occurs when assigning a layout to the error page.

Hi! This should be fixed with v2.13.1.