-
Notifications
You must be signed in to change notification settings - Fork 266
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
Inconsistent & potentially misleading behaviour when calling List RemoveItem
#632
Comments
RemoveItem
RemoveItem
Workaround I've found for this at the moment is to find the global index of the item being removed, and then call It is quite obviously less than ideal. But better than the alternative of "have the correct item removed from the filtered list but have a different item removed from the global list, or have the correct item removed from the global list but different item removed from the filtered list." |
If I understand the issue right: And ideally it should be the case where: Is my understanding for it correct? If so feel free to checkout this PR #638 if this is what you had in mind related to the issue, and the fix for it |
@prithvijj Something like that, yeah. Probably the simplest way to describe it is that it removes the item at that index in both the filtered & unfiltered items. But since they're filtered, the item at that index isn't the same between the two. I'll take a look at your PR. tbh, I found it somewhat odd that |
Describe the bug
RemoveItem
, when called, operates both on the unfiltered list & the filtered list resulting in misleading & inconsistent behaviour.If
index < len(filteredItems)
then filteredItems will be updated to remove the item at that index while simultaneously removing the item at the same index in the global list even if the two items do not match.If
index >= len(filteredItems)
then the global list will be updated to remove the item at that index while the filtered list is simultaneously not updated, even if the item that was removed is currently visible in the filtered list.Setup
Please complete the following information along with version numbers, if applicable.
To Reproduce
Steps to reproduce the behavior:
RemoveItem(0)
on the filtered listAlternatively:
RemoveItem(globalIndexOfFilteredItem)
on the filtered listSource Code
Please include source code if needed to reproduce the behavior.
Expected behavior
When an item is shown as being removed from the filtered list, the same item should be removed from the global list. Likewise, when an item is removed from the global list, that item should be removed from the filtered list if it is present.
Screenshots
Add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: