context: hotReload -> isHMR

This commit is contained in:
Sebastien Chopin 2017-08-23 13:41:25 +02:00
parent 459363beea
commit 4ac14054f2
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
export default function ({ app, store, route, params, error, redirect, hotReload }) {
// If middleware is called from hot-reloading, ignore it
if (hotReload) return
export default function ({ isHMR, app, store, route, params, error, redirect }) {
// If middleware is called from hot module replacement, ignore it
if (isHMR) return
// Get locale from params
const locale = params.lang || 'en'
if (store.state.locales.indexOf(locale) === -1) {

View File

@ -457,7 +457,7 @@ function addHotReload ($component, depth) {
<%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %>
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()' : '') %>
callMiddleware.call(this, Components, context)
.then(() => {

View File

@ -75,14 +75,14 @@ export function getContext (context, app) {
isClient: !!context.isClient,
isStatic: process.static,
isDev: <%= isDev %>,
isHMR: context.isHMR || false,
app: app,
<%= (store ? 'store: context.store,' : '') %>
route: (context.to ? context.to : context.route),
payload: context.payload,
error: context.error,
base: '<%= router.base %>',
env: <%= JSON.stringify(env) %>,
hotReload: context.hotReload || false
env: <%= JSON.stringify(env) %>
}
const next = context.next
ctx.params = ctx.route.params || {}