Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Iongtao opened this issue Aug 19, 2021 · 8 comments

Comments

@Iongtao
Copy link

Iongtao commented Aug 19, 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?

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

@posva
Copy link
Member

posva commented Aug 19, 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

@posva posva closed this as completed Aug 19, 2021
@Iongtao
Copy link
Author

Iongtao commented Aug 19, 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构建的,在本地使用运行也一样会有这样的错误。

@ygj6
Copy link
Member

ygj6 commented Aug 19, 2021

@Iongtao The discussion #1865 could help you?

@Iongtao
Copy link
Author

Iongtao commented Aug 19, 2021

@Iongtao The discussion #1865 could help you?

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

@titld
Copy link

titld commented Aug 19, 2021

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

@ygj6
Copy link
Member

ygj6 commented Aug 19, 2021

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

Hope it could help you.

@ycingit
Copy link

ycingit commented Oct 20, 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

@wuyuweixin
Copy link

+1

@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants