Fix tests

This commit is contained in:
Sebastien Chopin 2017-09-07 14:17:53 +02:00
parent b114717701
commit 9a28b8be25

View File

@ -131,9 +131,9 @@ async function loadAsyncComponents (to, from, next) {
}
}
function applySSRData(Component) {
function applySSRData(Component, ssrData) {
if (NUXT.serverRendered) {
applyAsyncData(Component, NUXT.data[index])
applyAsyncData(Component, ssrData)
Component._Ctor = Component
}
return Component
@ -146,14 +146,14 @@ function resolveComponents(router) {
return flatMapComponents(router.match(path), (Component, _, match, key, index) => {
// If component already resolved
if (typeof Component !== 'function' || Component.options) {
const _Component = applySSRData(sanitizeComponent(Component))
const _Component = applySSRData(sanitizeComponent(Component), NUXT.data[index])
match.components[key] = _Component
return _Component
}
// Resolve component
return Component().then(Component => {
const _Component = applySSRData(sanitizeComponent(Component))
const _Component = applySSRData(sanitizeComponent(Component), NUXT.data[index])
match.components[key] = _Component
return _Component
})