mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
context: hotReload -> isHMR
This commit is contained in:
parent
459363beea
commit
4ac14054f2
@ -1,6 +1,6 @@
|
|||||||
export default function ({ app, store, route, params, error, redirect, hotReload }) {
|
export default function ({ isHMR, app, store, route, params, error, redirect }) {
|
||||||
// If middleware is called from hot-reloading, ignore it
|
// If middleware is called from hot module replacement, ignore it
|
||||||
if (hotReload) return
|
if (isHMR) return
|
||||||
// Get locale from params
|
// Get locale from params
|
||||||
const locale = params.lang || 'en'
|
const locale = params.lang || 'en'
|
||||||
if (store.state.locales.indexOf(locale) === -1) {
|
if (store.state.locales.indexOf(locale) === -1) {
|
||||||
|
@ -457,7 +457,7 @@ function addHotReload ($component, depth) {
|
|||||||
<%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %>
|
<%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %>
|
||||||
router.push(path)
|
router.push(path)
|
||||||
}
|
}
|
||||||
let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, hotReload: true, next: next.bind(this), error: this.error }, app)
|
let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, isHMR: true, next: next.bind(this), error: this.error }, app)
|
||||||
<%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %>
|
<%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %>
|
||||||
callMiddleware.call(this, Components, context)
|
callMiddleware.call(this, Components, context)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -75,14 +75,14 @@ export function getContext (context, app) {
|
|||||||
isClient: !!context.isClient,
|
isClient: !!context.isClient,
|
||||||
isStatic: process.static,
|
isStatic: process.static,
|
||||||
isDev: <%= isDev %>,
|
isDev: <%= isDev %>,
|
||||||
|
isHMR: context.isHMR || false,
|
||||||
app: app,
|
app: app,
|
||||||
<%= (store ? 'store: context.store,' : '') %>
|
<%= (store ? 'store: context.store,' : '') %>
|
||||||
route: (context.to ? context.to : context.route),
|
route: (context.to ? context.to : context.route),
|
||||||
payload: context.payload,
|
payload: context.payload,
|
||||||
error: context.error,
|
error: context.error,
|
||||||
base: '<%= router.base %>',
|
base: '<%= router.base %>',
|
||||||
env: <%= JSON.stringify(env) %>,
|
env: <%= JSON.stringify(env) %>
|
||||||
hotReload: context.hotReload || false
|
|
||||||
}
|
}
|
||||||
const next = context.next
|
const next = context.next
|
||||||
ctx.params = ctx.route.params || {}
|
ctx.params = ctx.route.params || {}
|
||||||
|
Loading…
Reference in New Issue
Block a user