mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-29 23:02:42 +00:00
chore: minor fixes
This commit is contained in:
parent
a9f2f299a3
commit
518692b2f4
@ -279,10 +279,14 @@ async function render (to, from, next) {
|
||||
|
||||
// Call fetch(context)
|
||||
if (hasFetch) {
|
||||
const promise = Component.options.fetch.call(_this, context).then(fetchResult => {
|
||||
let p = Component.options.fetch.call(_this, context)
|
||||
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
|
||||
p = Promise.resolve(p)
|
||||
}
|
||||
p.then(fetchResult => {
|
||||
<% if(loading) { %>if(this.$loading.increase) this.$loading.increase(loadingIncrease)<% } %>
|
||||
})
|
||||
promises.push(promise)
|
||||
promises.push(p)
|
||||
}
|
||||
|
||||
return Promise.all(promises).then(() => {
|
||||
@ -364,8 +368,10 @@ function fixPrepatch (to, ___) {
|
||||
}
|
||||
this.setLayout(layout)
|
||||
|
||||
<% if (isDev) { %>
|
||||
// Hot reloading
|
||||
setTimeout(() => hotReloadAPI(this), 100)
|
||||
<% } %>
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,8 @@ async function createApp (ssrContext) {
|
||||
const _nuxt = this._nuxt || this.$options._nuxt
|
||||
_nuxt.dateErr = Date.now()
|
||||
_nuxt.err = err
|
||||
console.error(err)
|
||||
console.error('[nuxt] ' + err)
|
||||
return err
|
||||
}
|
||||
},
|
||||
|
@ -81,12 +81,12 @@ export default async context => {
|
||||
// Resolve components
|
||||
let Components = []
|
||||
try {
|
||||
Components = await Promise.all(getMatchedComponents(router.match(context.url)).map((Component) => new Promise((resolve, reject) => {
|
||||
Components = await Promise.all(getMatchedComponents(router.match(context.url)).map(Component => {
|
||||
if (typeof Component !== 'function' || Component.super === Vue) {
|
||||
return resolve(sanitizeComponent(Component))
|
||||
return sanitizeComponent(Component)
|
||||
}
|
||||
return Component().then(Component => sanitizeComponent(Component))
|
||||
})))
|
||||
}))
|
||||
} catch (err) {
|
||||
// Throw back error to renderRoute()
|
||||
throw err
|
||||
|
Loading…
Reference in New Issue
Block a user