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

Moving an element drops the ref #1789

Closed
skirtles-code opened this issue Aug 5, 2020 · 0 comments · Fixed by #1835
Closed

Moving an element drops the ref #1789

skirtles-code opened this issue Aug 5, 2020 · 0 comments · Fixed by #1835
Labels
🐞 bug Something isn't working

Comments

@skirtles-code
Copy link
Contributor

Version

3.0.0-rc.5

Reproduction link

https://jsfiddle.net/skirtle/L79q43ya/6/

Steps to reproduce

  1. Open the console log.
  2. Click the button.
  3. Note the ref inputEl is null.

What is expected?

inputEl should reference the appropriate element.

What is actually happening?

It's null.


The example is attempting to move an input between the bottom and top of the component. It is only ever in one place at once so the template uses the same ref in both cases.

It seems that removing a VNode triggers a null ref during unmounting. This problem also impacted one of the examples in the documentation (see vuejs/docs#353).

I originally stumbled across this while using v-for with ref. Based on #1166 it would seem that may no longer be supported, so I removed it from my example. It's a bit unclear what's planned as I can't find an RFC and currently the Vue 3 documentation just describes the Vue 2 behaviour with a few additions about the composition API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working
Projects
None yet
2 participants