Coder Social home page Coder Social logo

Comments (6)

guizoxxv avatar guizoxxv commented on June 2, 2024

Nervermind. I just realized I missed this part in the documentation: "use computed props or watchers to properly react to props changes!".

Thank you.

from vue-virtual-scroller.

knidhi avatar knidhi commented on June 2, 2024

@guizoxxv I m also facing this issue after migrating to vue3.
How did you solve the issue?

from vue-virtual-scroller.

guizoxxv avatar guizoxxv commented on June 2, 2024

@knidhi

I used a computed property in the RecycleScroller items prop. I copied the array value using the spread operator (shallow copy was enought for me).

computed: {
  list() {
    return [...this.users];
  },
},

Here is a demo: https://stackblitz.com/edit/vue-sq6hfb?file=src%2FApp.vue

from vue-virtual-scroller.

knidhi avatar knidhi commented on June 2, 2024

@guizoxxv Thanks for your reply! Shallow copying worked for me too.
But the issue you reported seems valid to me. Mutating the users array to propagate updates is what Vue recommends and the newly added user is displaying when we render the list without virtual scroller.
We should not have to create a new array like this.

from vue-virtual-scroller.

srackhall avatar srackhall commented on June 2, 2024

image

For addition, it is indeed useful, but for deletion, it does not have an effect (simple views may be effective, as shown in the above figure).

Especially for complex elements (such as nested virtual scrolling), repeated folding may occur. As shown in the above figure, due to the fact that the dom element has not been recycled, when the element is complex, it will still be displayed overlapping in the left view.

Here is a demo: https://stackblitz.com/edit/vue-qpzbjg?file=src%2FApp.vue
It can be observed in F12 that the corresponding dom was not immediately correctly reclaimed, thus still causing a bug of view overlap(The elements in the example are relatively simple and cannot be observed from the view).

from vue-virtual-scroller.

srackhall avatar srackhall commented on June 2, 2024

I think this issue should be reopened because there is still a possibility of errors during the deletion process (although the probability is very low)

from vue-virtual-scroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.