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 }) { 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) {

View File

@ -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(() => {

View File

@ -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 || {}