Subscribe on changes!

使用动态组件时,本地热更新被缓存组件会报异常parentComponent.ctx.deactivate is not a function

avatar
Aug 19th 2021

Version

3.2.4

Reproduction link

https://codesandbox.io/s/525k8

Steps to reproduce

编辑keep-alive中的组件,保存使之热更新后会报错。 例如,编辑上方codesandbox中示例中components/tab1.vue后保存就会抛出异常

What is expected?

正常热更新,无错误信息

What is actually happening?

热更新时报错,导致热更新失败

avatar
Aug 19th 2021

This works fine in a vite and vue/cli project. The codesandbox template you used doesn't seem to be up to date or doesn't handle HMR correctly

avatar
Aug 19th 2021

This works fine in a vite and vue/cli project. The codesandbox template you used doesn't seem to be up to date or doesn't handle HMR correctly

我的项目是vite构建的,在本地使用运行也一样会有这样的错误。

avatar
Aug 19th 2021

@Iongtao The discussion #1865 could help you?

avatar
Aug 19th 2021

@Iongtao The discussion #1865 could help you?

我看过了, 但我不太了解这个key该如何使用,官方文档中没有提到component的key这个属性

avatar
Aug 19th 2021

所以 你是怎么解决的呢?我也遇到这个问题了,key值这块儿好像没用,路由版本已经是最新的4.0了

avatar
Aug 19th 2021

I have fixed @danyadev's project: https://github.com/ygj6/vue3-bug/tree/bug-2

Hope it could help you.

avatar
Oct 20th 2021

I have fixed @danyadev's project: https://github.com/ygj6/vue3-bug/tree/bug-2

Hope it could help you.

image

Version 3.2.20

Steps to reproduce 当a组件被keep-alive缓存,切换到b组件,再切换回a组件,对a组件 setup 进行代码更新,hmr热更新就会报错。

What is expected? 正常热更新,无错误信息

What is actually happening? 热更新时报错,导致热更新失败

@posva @ygj6

avatar
Jul 5th 2022

+1