-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Reducing the number of items in the array will not render correctly #106
Comments
A naive update, like adding the following line just before re-evaluating the existing bindings:
does not fully resolve this issue. I think I will wait for the pending pull requests 96 and 101 to be merged, as it all seem somewhat related. |
@EisenbergEffect, can you assign this issue to me? |
@altenstedt, more than just providing a correct |
Could this be related to #60? I'm hoping... 😃 |
@Thanood, it is most likely related. I'm digging into some of the bugs in the virtualization list, and there does seem to be some bugs in how it handles mutation of arrays (which includes arrays with filters). |
I have it so the indexes are all correct now. The last little bit is getting the scrolling scenario under wraps. |
@AStoker we are experiencing a similar issue of certain bindings not updating until you refresh the page when an item is removed from our array. What is the status on your potential release? |
@bdacoderchris, I think I have the solution, but I need to finish writing some tests and fixing one that is failing. I'm out for the weekend (no internet where I'm going). Best case is I get the PR in the next few hours, otherwise probably Monday morning. |
Resolves: aurelia#106, aurelia#98, aurelia#89 Previous behavior did not handle array changes correctly (in particular changes with the size of the array). Behavior now allows for array changes with different sizes, and should keep appropriate scroll positions.
Resolved (hopefully) by #107 |
I'm submitting a bug report
1.0.0-beta.3.0.2
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
4.5.0
NPM Version:
3.8.9
JSPM OR Webpack AND Version
JSPM 0.16.32
Browser:
all
Language:
all
Current behavior:
When reducing the number of items in the array, virtual-repeat.for will not render items correctly.
Expected/desired behavior:
The code in
ArrayVirtualRepeatStrategy._inPlaceProcessItems
does not seem to properly handle the case when a new array is bound to the virtual-repeat attribute that has fewer items than the current viewdisplays.
So, for example, if I have a view like so:
And update the items array in the view model like so:
Notice that I re-bind to a new array. I am not using a value converter. This cause
VirtualRepeat.itemsChanged
to run.Where
array
has fewer items that the previous value of this.items, then the code that access the items array around line 46 (items[i + first]
) might access items outside the bounds of the new array, if the user is scrolled down in the view.I do not understand the code enough to provide a fix, but I am willing to put in an effort given a little guidance. This module is very useful for us.
The text was updated successfully, but these errors were encountered: