Skip to content
New issue

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

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

Already on GitHub? # to your account

v-for not reusing existing elements #12937

Open
ereveniaud opened this issue Jan 18, 2023 · 3 comments
Open

v-for not reusing existing elements #12937

ereveniaud opened this issue Jan 18, 2023 · 3 comments

Comments

@ereveniaud
Copy link

Version

2.7.14

Reproduction link

codepen.io

Steps to reproduce

  • Focus an input in the list
  • Scroll up, the input still has the focus (row reused)
  • Scroll down, the input loose the focus (row rendered)

What is expected?

Elements should not be re-rendered when scrolling down (same behavior as scroll up)

What is actually happening?

When scrolling up, only new elements are rendered.
When scrolling up, all elements are rendered


Work as expected in Vue 3 (codepen: https://codepen.io/thel-rico/pen/mdjqVZJ)

@v-bilyavskiy
Copy link

unfortunately, this is also a problem for me
@ereveniaud maybe you found a workaround?

@LeiDeMing
Copy link

This is because when scrolling down, vue updates the child nodes by comparing the first one with the next one, so each vnode will be updated.

@klmhyeonwoo
Copy link

👀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants