VirtualScroll is, as it was in ionic1 badly implemented without being properly tested with different usecases. This issue assumes you have a listview using VirtualScroll. One element is ion-item which has click event leading you to details page of that element.
On details page, you change the single object of your array of elements, being show in VirtualScroll.
Going back from the details page to virtualscrollview will always lead you to being at the top of the virtualscroll and will not remember the positioning, since the object has been changed.
So if you would click on element 51 out of 1000, then come back, you will see that you're starting at the top of the view again and not at element 51, which leads to usage of VirtualScroll being unusable. Similar issue/behavior has also been reported on the forums (https://forum.ionicframework.com/t/virtual-scroll-remove-or-hide-item-without-reset-lost-scroll-position/54024/9), but without any official replies.
Clicking element 51, navigating to details page of element 51, clicking back would lead you to exact same position you were before.
Steps to reproduce:
Which Ionic Version? 1.x or 2.x
Ionic Version 2 beta9
Run ionic info from terminal/cmd prompt: (paste output below)
$ ionic info
Your system information:
You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.9
Ionic CLI Version: 2.0.0-beta.31
Ionic App Lib Version: 2.0.0-beta.17
OS:
Node Version: v5.9.1
My use case - deleting an item from the array, even without navigating from the list.
It also makes virtualscroll unusable with infinitescroll, as it jumps to the top when new items are fetched
Perhaps slightly related: #6787
It is related to #6423.
Hello everyone! Thanks for using Ionic! We have been hard at work lately with virtualscroll. The issue here is that when you update the virtualscroll with data after it has already been rendered the measurements that virtual scroll uses to lazily render elements then become wrong. When this happens the virtual scroll has to re-render itself entirely, therefore making it look like it has jumped back to the beginning of the list. We are well aware of this issue and hope to have a solution for it soon. Also, just to keep our issues concise and not have duplicates I am going to close this one as a duplicate of https://github.com/driftyco/ionic/issues/6423 . You can track the status of this issue over on that issue. Also, feel free to put any findings you may have on that issue. Thanks again everyone!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
It also makes virtualscroll unusable with infinitescroll, as it jumps to the top when new items are fetched