修改 DiffUtil.DiffResult 为参数的 setDiffNewData 方法#3688
Open
LandChanning wants to merge 1 commit intoCymChad:masterfrom
Open
修改 DiffUtil.DiffResult 为参数的 setDiffNewData 方法#3688LandChanning wants to merge 1 commit intoCymChad:masterfrom
LandChanning wants to merge 1 commit intoCymChad:masterfrom
Conversation
``` 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)依然是旧的,所以提个合并请求
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个方法中,this.data = list 是在 diffResult.dispatchUpdatesTo 之后调用的,请问这个调用顺序是有什么特殊作用吗?
我的理解这会导致 adapter.notify 系列方法触发时,数据源(this.data)依然是旧的,所以提个合并请求。
Thank you for contributing to BaseRecyclerViewAdapterHelper. Before pressing the "Create Pull Request" button, please consider the following points:
[1] Please give a description about what and why you are contributing, even if it's trivial.
[2] Please include the issue list number(s) or other PR numbers in the description if you are contributing in response to those.
[3] Please include a reasonable set of demo tests if you contribute new code or change an existing one. please make sure you have demo for working correctly.