hilongjw / vue-recyclerview

Mastering Large Lists with the vue-recyclerview
https://hilongjw.github.io/vue-recyclerview/
MIT License
1.45k stars 121 forks source link

Scrolling to last index in list (bottom) render problem #8

Closed hazzo closed 7 years ago

hazzo commented 7 years ago

Hi @hilongjw, excelente method for scrolling to index but when you set the last index of list the recyclerview renders to many tombstones in dom.

Thanks again!

Edited: It doesn't render items it renders to many tombstones

hilongjw commented 7 years ago

@hazzo, Thank you for your feedback, scrollToIndex (index) by calling fill (0, index) to achieve, there will be such a problem, I will try to modify here, make it automatically recycle unnecessary tombstones.

hazzo commented 7 years ago

My pleasure, i'm looking forward to use this for production in a chat app 😄

Okay, you are forcing the scroll by filling the recyclerview with the elements before the index to scroll.

Maybe it could be fixed with a fetch from last index to top? What I mean, instead of fetching from the beginning of the array list start from the bottom, and instead of pushing elements unshift them.

Just an idea.

hilongjw commented 7 years ago

Wow, sounds good, 👍. My thoughts are similar to you:

 scrollToIndex (index) {
    const lastItemCount = this.lastAttachedItem_ - this.firstAttachedItem_
    this.fill(index - lastItemCount, index + 1)
  },
hilongjw commented 7 years ago

fixed at 0.3.1

hazzo commented 7 years ago

Perfect! Now DOM it's cleaner!