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

切换组件报错,可能是transition+keep-alive的问题 #5680

Closed
npmrun opened this issue Apr 7, 2022 · 4 comments
Closed

切换组件报错,可能是transition+keep-alive的问题 #5680

npmrun opened this issue Apr 7, 2022 · 4 comments
Labels
has workaround A workaround has been found to avoid the problem scope: keep-alive scope: transition

Comments

@npmrun
Copy link

npmrun commented Apr 7, 2022

Version

3.2.27 及以上

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. 输入11
  2. 点击切换
  3. 输入 22
  4. 点击前往CC
    然后就报错了,怎么点都报错

What is expected?

正常切换组件

What is actually happening?

切换报错

@npmrun npmrun changed the title 可能是transition+keep-alive的问题 切换组件报错,可能是transition+keep-alive的问题 Apr 7, 2022
@JianJroh
Copy link

Version

3.2.27 及以上

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  1. 输入11
  2. 点击切换
  3. 输入 22
  4. 点击前往CC
    然后就报错了,怎么点都报错

What is expected?

正常切换组件

What is actually happening?

切换报错

function toggleCC(){
    t.value = 2;
+  nextTick(() => {
     Comp.value=CC  // 挂载到Parent 行为 
+  });
}

t.value = 2 卸载Parent dom行为 与 Comp.value=CC 挂载到Parent dom 行为,在同一队列下执行是矛盾的,如报错 Cannot read properties of null (reading 'parentNode')所说

@npmrun
Copy link
Author

npmrun commented Apr 18, 2022

是的,加了nextTick不报错了。如果是去掉transition也不报错

@edison1105 edison1105 added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. has workaround A workaround has been found to avoid the problem and removed 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Aug 12, 2024
@edison1105
Copy link
Member

Closing as it can not reproduce anymore.
see playground

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has workaround A workaround has been found to avoid the problem scope: keep-alive scope: transition
Projects
None yet
Development

No branches or pull requests

4 participants