Skip to content
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

Make RearrangeableListContainer<> only replace differences #6425

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

smoogipoo
Copy link
Contributor

When using ReplaceRange() it will no longer re-add items that were previously and still are in the list.

Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to try

Comment on lines +108 to +112
IEnumerable<TModel> tOldItems = e.OldItems?.Cast<TModel>() ?? [];
IEnumerable<TModel> tNewItems = e.NewItems?.Cast<TModel>() ?? [];

removeItems(tOldItems.Except(tNewItems));
addItems(tNewItems.Except(tOldItems));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only qualm I have about this is how this implicitly relies on equality semantics, i.e. on TModel having a sane equality implementation. But I guess maybe fine to try...?

@bdach bdach enabled auto-merge November 18, 2024 09:03
@bdach bdach merged commit dc98996 into ppy:master Nov 18, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants