每个人都有一个"add to favourites“按钮,这是一种将空星更新为全星(条件渲染)的方法,如果单击该按钮,将更新组件的状态,并且每当本地状态发生更改时,它都会触发父组件来更新其状态-从那里父组件将所有数据保存到数据库问题是,当更新父级的状态时,它相当慢。它会冻结1-1.5秒。但是如果我删除方法来更新父元素的状态,这是很酷的(我已经在附加的示例中做了标记)。问题1:如何重构此代码
我正在尝试在写事务之后查找插入/删除的对象。/// The indices of objects in the previous version of the collection which have@property (nonatomic, readonly) NSArray<NSNumber *> *deletions;
/// The indices in the new version of the collection which were newly inserted