Every now and then Vue seems to break when hot-reloading VueRouter with keep-alive routes. The error is: _vue.common.js:1082 Uncaught TypeError: Cannot read property '__v_trans' of null_. Digging in it looks like vm.$el is empty in the insert function. Null is passed up until it crashes in applyTransition.
The callstack is as follows:
function applyTransition(el, direction, op, vm, cb) { el = null, direction = 1, op = (), vm = VueComponent {$router: Router, $el: null, $parent: null, $root: null, $children: null…}, cb = undefined
var transition = el.__v_trans;
function beforeWithTransition(el, target, vm, cb) {
applyTransition(el, 1, function () {
function insert(vm, target, cb, withTransition, op1, op2) { vm = VueComponent {$router: Router, $el: null, $parent: null, $root: null, $children: null…}, target = text, cb = undefined, withTransition = undefined
...
op(vm.$el, target, vm, cb);
Vue.prototype.$before = function (target, cb, withTransition) { target = text, cb = undefined, withTransition = undefined
return insert(this, target, cb, withTransition, beforeWithCb, beforeWithTransition);
VueRouter.transition
VueRouter.insert
...
I do not use transitions yet and have no idea what it might be. It happens when i switch routes after hot-reloading changes.
I encountered the same problem.
In my .vue file, if I set keep-alive in <router-view>, after modifying .vue file and hot-reloading, console report the same error.
The same exception:
vue.common.js?b6d4:1082 Uncaught TypeError: Cannot read property '__v_trans' of null
Always with another exception:
vue.common.js?b6d4:9095 Uncaught TypeError: Cannot read property 'parentNode' of null
My router-view is simple.
<router-view class="view" keep-alive ></router-view>
而且出现得比较随机,开始几次切换都是正常的,后来就突然出错了。出错之后,整个路由就坏掉了,不管点什么链接(v-link) 都无法进行切换。
这个刷新下就好了
I don't think refreshing the page is a good idea, especially for a single page application.
Bug need to fix.
Now I take the keepalive away, as a temporary solution.
the same
Same issue :+1:
same issue how do solve it ?
same
Most helpful comment
same issue how do solve it ?