Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuever committed Sep 15, 2023
1 parent 083c7c9 commit 4203a53
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
1 change: 1 addition & 0 deletions packages/data-model/src/ListBaseDimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ class ListBaseDimensions<ItemT extends {} = {}> {
}

applyStateResult(stateResult: ListStateResult<ItemT>) {
return true
let shouldStateUpdate = false;

if (!this._stateResult && stateResult) {
Expand Down
45 changes: 20 additions & 25 deletions packages/data-model/src/ListGroupDimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ class ListGroupDimensions<ItemT extends {} = {}>
},
};
// should update indexKeys first !!!
this.pushIndexKey(listKey);
// this.pushIndexKey(listKey);
this.startInspection()
const { recyclerType } = listDimensionsProps
const dimensions = new ListDimensions({
...listDimensionsProps,
Expand All @@ -561,10 +562,10 @@ class ListGroupDimensions<ItemT extends {} = {}>
// update dimensionsIntervalTree (to fix Dimensions with default layout
// such getItemLayout)
this.recalculateDimensionsIntervalTreeBatchinator.schedule();
this.registeredKeys.push(listKey);
// this.registeredKeys.push(listKey);
this.updateFlattenData(listKey, listDimensionsProps.data);

this._startInspectBatchinator.schedule();
// this._startInspectBatchinator.schedule();

return {
dimensions,
Expand Down Expand Up @@ -613,15 +614,6 @@ class ListGroupDimensions<ItemT extends {} = {}>
// this._updateChildPersistanceIndicesBatchinator.schedule();
}

// updateChildPersistanceIndices() {
// this.indexKeys.forEach((key) => {
// const dimension = this.getDimension(key);
// if (dimension instanceof ListDimensions) {
// dimension?.updatePersistanceIndicesDueToListGroup();
// }
// });
// }

/**
* 当item layout发生变化以后,这个时候要将子 dimension的相对高度重新计算一下
*/
Expand Down Expand Up @@ -673,19 +665,21 @@ class ListGroupDimensions<ItemT extends {} = {}>

// 比如说,中间发生了顺序调整;自动检测确保
if (
!this.registeredKeys.length &&
resolveChanged(this._heartBeatingIndexKeys, this.indexKeys).isEqual
!resolveChanged(this._heartBeatingIndexKeys, this.indexKeys).isEqual
) {
if (
!shallowArrayEqual(
this._heartBeatingIndexKeys,
this._heartBeatingIndexKeysSentCommit
)
) {
this.indexKeys = nextIndexKeys;
this.onItemsCountChanged();
this._heartBeatingIndexKeysSentCommit = this.indexKeys;
}
// if (
// !shallowArrayEqual(
// this._heartBeatingIndexKeys,
// this._heartBeatingIndexKeysSentCommit
// )
// ) {
// this.indexKeys = nextIndexKeys;
// this.onItemsCountChanged();
// this._heartBeatingIndexKeysSentCommit = this.indexKeys;
// }

this.indexKeys = nextIndexKeys;
this.onItemsCountChanged();

this._inspectingTime += 1;

Expand Down Expand Up @@ -721,7 +715,8 @@ class ListGroupDimensions<ItemT extends {} = {}>
this.registeredKeys.splice(indexInRegisteredKeys, 1);
}

this._heartBeatResolveChangedBatchinator.schedule();
this.heartBeatResolveChanged()
// this._heartBeatResolveChangedBatchinator.schedule();
}

getInspectAPI(): InspectingAPI {
Expand Down

0 comments on commit 4203a53

Please sign in to comment.