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

v-for not reusing existing elements #12937

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

v-for not reusing existing elements #12937

ereveniaud opened this issue Jan 18, 2023 · 2 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.

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

No branches or pull requests

3 participants