Dont use _routerViewCache anymore

This commit is contained in:
Sébastien Chopin 2016-12-20 12:55:25 +01:00
parent 2e2062e045
commit 66124e5bce

View File

@ -142,18 +142,11 @@ function render (to, from, next) {
// When navigating on a different route but the same component is used, Vue.js
// will not update the instance data, so we have to update $data ourselves
function fixPrepatch (to, ___) {
if (!this.$nuxt._routerViewCache || !this.$nuxt._routerViewCache.default) {
return
}
Vue.nextTick(() => {
let instances = getMatchedComponentsInstances(to)
instances.forEach((instance) => {
instances.forEach((instance, i) => {
if (!instance) return;
let file = instance.$parent._routerViewCache.default.__file
if (typeof instance.$parent._routerViewCache.default === 'function') {
file = instance.$parent._routerViewCache.default.options.__file
}
if (instance.constructor.options.__file === file) {
if (_lastPaths[i] === instance.constructor._path) {
let newData = instance.constructor.options.data()
for (let key in newData) {
Vue.set(instance.$data, key, newData[key])