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

修改 DiffUtil.DiffResult 为参数的 setDiffNewData 方法 #3688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 8, 2022

  1. 修改 DiffUtil.DiffResult 为参数的 setDiffNewData 方法

    ```
    open fun setDiffNewData(@nonnull diffResult: DiffUtil.DiffResult, list: MutableList<T>) {
            if (hasEmptyView()) {
                // If the current view is an empty view, set the new data directly without diff
                setNewInstance(list)
                return
            }
            diffResult.dispatchUpdatesTo(BrvahListUpdateCallback(this))
            this.data = list
        }
    ```
    这个方法中,this.data = list 是在 diffResult.dispatchUpdatesTo 之后调用的,请问这个调用顺序是有什么特殊作用吗?
    我的理解这会导致 adapter.notify 系列方法触发时,数据源(this.data)依然是旧的,所以提个合并请求
    LandChanning authored Sep 8, 2022
    Configuration menu
    Copy the full SHA
    a9b0a7a View commit details
    Browse the repository at this point in the history