airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.51k stars 728 forks source link

Sticky header does not call bind methods when it transitions from stuck header to scrollable item #1364

Open ryannickel-autodesk opened 1 year ago

ryannickel-autodesk commented 1 year ago

We are using the Kotlin with the View Holder pattern. I added logging statements that are output when preBind, bind and unbind are called on the model to determine the root cause.

  1. In a recycler view add items, some with sticky headers - need to have multiple sticky header items with some other items between them. For this example assume we have Sticky Headers 0, 5, and 10 with 4 items between them.
  2. When the recycler view is first displayed observe that prebind and bind is called for all headers displayed.
  3. Scroll down so that a sticky header item 5 is in the middle of the recycler view.
  4. Scroll up until sticky header item 5 is stuck at the top. Observer that prebind and bind are both called.
  5. Scroll down until sticky header item 5 is not stuck at the top (scrolling in the list). Observe that unbind is called, but prebind and bind are not called again once it is back to scrolling with the list.
  6. At this point the only way to get prebind and bind to be called for the instance scrolling in the list is to scroll down and back up again.

So the issue seems to be when the transition from header stuck at the top, to scrolling in the list the prebind / bind methods are not called. Similarly, when the transition from scrolling in the list to stuck header occurs unbind is not called.

May be related to Issue 1230 and this recent comment on the original PR.