Skip to content

Commit

Permalink
fix: set default name to layout to avoid multi mounted (#7128)
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Mar 25, 2020
1 parent 90c6922 commit b82f8d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/vue-app/template/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
getMatchedComponentsInstances,
getChildrenComponentInstancesUsingFetch,
promisify,
globalHandleError
globalHandleError,
sanitizeComponent
} from './utils'
<% } %>
<% if (features.layouts && components.ErrorPage) { %>import NuxtError from '<%= components.ErrorPage %>'<% } %>
Expand All @@ -23,7 +24,7 @@ import '<%= relativeToBuild(resolvePath(c.src || c, { isStyle: true })) %>'
}
}).join('\n') %>

const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": _${hash(key)}`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>
const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": sanitizeComponent(_${hash(key)})`).join(',') %> }<%= isTest ? '// eslint-disable-line' : '' %>

<% if (splitChunks.layouts) { %>let resolvedLayouts = {}<% } %>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-app/template/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function sanitizeComponent (Component) {
Component._Ctor = Component
Component.extendOptions = Component.options
}
// For debugging purpose
// If no component name defined, set file path as name, (also fixes #5703)
if (!Component.options.name && Component.options.__file) {
Component.options.name = Component.options.__file
}
Expand Down

0 comments on commit b82f8d1

Please sign in to comment.