question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Epoxy Recyclerview displays duplicate items that are not in the dataset

See original GitHub issue

I’ve run into an issue that seems to be related to some kind of race condition going on in the Epoxy code.

I’m use a PagedListEpoxyController. I do a lot of rapid updates to the data set and Epoxy is usually great for that given the diffing and everything.

But I seem to run into an issue when I have am editing my data set and quickly requesting new model builds. I edit my data set by copying (using kotlin data classes).

The issue I’m seeing is that the recycler view is displaying items twice even though they aren’t in my data set.

The example is for a messaging app

  1. I send a message: a new model gets added to my data set with a sending state that is reflected visually on the model view (loader)
  2. I immediately send another message, new data gets added again
  3. The first message API call returns, the data gets manipulated so the message is no longer in sending state, view gets updated
  4. The second message API call returns immediately after, that view gets updated correctly.

The problem is… All the sudden the first set of data that was originally added to my data list is at the bottom of the list. I.E. My first X messages that were loaded when I opened my app are now duplicated below my last 2 messages I just sent.

I debugged and I’m stumped. I verified that the data set I’m feeding to my controller does not contain the duplicates and thus the recycler view is not reflecting my data set. The behavior is not consistent. It seems to happen when calls to loadBefore in my PageKeyedDataSource (Paging library) get triggered. So I can more easily reproduce if I send multiple messages, scroll up to load more data thru paging. I’ve found the paging library to be kinda finicky so calls to loadBefore can happen a lot.

But even if a lot of calls are being made, I can’t figure out why my RecyclerView would be displaying these duplicate items that are NOT in the data set. I verified this with logs…debugging doesn’t work because it has to do with some kind of race.

Has this issue come up before? The view displaying things that are not in the data set?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:43 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
kakai248commented, Jan 8, 2019

I would also like to point out #567

From what we gathered in that thread it seems to be related with requesting a model build while another one is running.

0reactions
elihartcommented, Jan 22, 2019

Some synchronization issues have been fixed in the 3.2.0 release, let me know if there are any further problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RecyclerView is duplicating items - Stack Overflow
My recyclerview is duplicating items when I roll it and I'm already calling adapter.notifyDataSetChanged() . So, probably I'm calling data ...
Read more >
RecyclerView scrolls down on data update using Paging with ...
I have a simple key/value table in a Room database that I display in a RecyclerView with a PagedListAdapter. The item views each...
Read more >
Epoxy for Android - Airbnb Engineering & Data Science
Epoxy is an Android library for building complex screens in a RecyclerView. It abstracts the boilerplate of view holders, item types, item ids,...
Read more >
Epoxy: Airbnb's View Architecture on Android - Medium
Android's RecyclerView is a powerful tool for displaying lists of items, but its usage is cluttered with boilerplate and configuration.
Read more >
Displaying API data with Epoxy | Android 2022 | Kotlin
This episode covers everything you need to know about handling network requests, mapping API data to domain data, and displaying the data in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found