<% if (loading) { %><% } %>
-
+ <% if (layoutTransition) { %><% } %>
+
+ <% if (layoutTransition) { %><% } %>
diff --git a/lib/app/components/nuxt-child.js b/lib/app/components/nuxt-child.js
index 39b8e3c4e7..8df1feb71d 100644
--- a/lib/app/components/nuxt-child.js
+++ b/lib/app/components/nuxt-child.js
@@ -37,6 +37,19 @@ export default {
name: 'nuxt-child',
functional: true,
render (h, { parent, data }) {
+ const nuxt = parent.$root.nuxt
+ const component = parent.$route.matched[0].components.default
+
+ const layoutUid = parent._uid
+ const layoutName = component.options ? component.options.layout : null
+
+ // If we're changing layout render the stored vnode
+ if (nuxt._layoutUid === layoutUid &&
+ nuxt._layoutName !== layoutName) return nuxt._childVnode
+
+ nuxt._layoutUid = layoutUid
+ nuxt._layoutName = layoutName
+
data.nuxtChild = true
const _parent = parent
const transitions = parent.$nuxt.nuxt.transitions
@@ -62,11 +75,14 @@ export default {
listeners[key] = transition[key].bind(_parent)
}
})
- return h('transition', {
+
+ nuxt._childVnode = h('transition', {
props: transitionProps,
on: listeners
}, [
h('router-view', data)
])
+
+ return nuxt._childVnode
}
}
diff --git a/lib/app/components/nuxt.vue b/lib/app/components/nuxt.vue
index 2817b3af9a..2bdd096dd8 100644
--- a/lib/app/components/nuxt.vue
+++ b/lib/app/components/nuxt.vue
@@ -1,6 +1,8 @@