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

PPJG-2914 Remove last callback #24

Merged
merged 6 commits into from
Apr 4, 2024
Merged

Conversation

Manwtein
Copy link
Contributor

We have to remove the previous callback if we set new items, since the callback could break the logic with the predictive animations(see supportsPredictiveItemAnimations) which are calculated via a few onLayout callback.

Dm me in slack if you need to see the reproduction

We have to remove the previous callback if we set new items, since the callback could break the logic with the predictive animations(namely supportsPredictiveItemAnimations) which are calculated via a few onLayout callbacks
@@ -141,9 +143,18 @@ open class RxDiffAdapter @Deprecated("Replace with constructor without delegates
diffResult.dispatchUpdatesTo(this)
}

val lastCallback = lastDispatchDiffCallback
if (lastCallback != null) {
rv.removeCallbacks(lastCallback)

Choose a reason for hiding this comment

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

Cancelling current task may postpone dispatching items to recycler(if updates happens frequently).
Proposal here:

  • let's schedule task for dispatching new state(if it's required)
  • make that runnable mutable and update it's state here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do in a separate ticket and dm you with the reference

@yatsinar yatsinar merged commit 083577a into master Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants