Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Conversation

@StylianosGakis
Copy link

Fix DiffUtil.ItemCallback implementation

The areItemsTheSame documentation explicitly says:
"For example, if your items have unique ids, this method should check their id equality."

In the current state, the DiffUtil.ItemCallback is implemented wrong.

override fun areItemsTheSame(oldItem: Flower, newItem: Flower): Boolean {
return oldItem == newItem
}
override fun areContentsTheSame(oldItem: Flower, newItem: Flower): Boolean {
return oldItem.id == newItem.id
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant