Skip to content

Commit

Permalink
FIX: Redundant master record calls avoided #1836
Browse files Browse the repository at this point in the history
* Row changed reaction was not disposed and new reactions were started after changing filters
* MasterRecord was called twice after changing filters
* disposers removed because they did not contain up to date SelectedRowReaction disposer and were never used anyway
* Fixed parameter values
  • Loading branch information
tvavrda committed Aug 31, 2023
2 parents 5247574 + 79561c7 commit f12b470
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ export class DataViewLifecycle implements IDataViewLifecycle {
return this.monitor.isWorkingDelayed;
}

disposers: any[] = [];

@action.bound
start(): void {
if (isLazyLoading(this)) {
this.disposers.push(this.startSelectedRowReaction());
this.startSelectedRowReaction();
}
}

Expand Down Expand Up @@ -92,6 +90,12 @@ export class DataViewLifecycle implements IDataViewLifecycle {
await this.onSelectedRowIdChangeImm();
}

if (this._selectedRowReactionDisposer){
return;
}

this.stopSelectedRowReaction();

const self = this;
return (this._selectedRowReactionDisposer = reaction(
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ export class FormScreenLifecycle02 implements IFormScreenLifecycle02 {
yield this.updateTotalRowCount(rootDataView);
yield*this.readFirstChunkOfRows({
rootDataView: rootDataView,
preloadIsDirty: preloadIsDirty
preloadIsDirty: preloadIsDirty,
runChangeRowReaction: true
});
}
}
Expand Down Expand Up @@ -881,6 +882,7 @@ export class FormScreenLifecycle02 implements IFormScreenLifecycle02 {

*readFirstChunkOfRows(args: {
rootDataView: IDataView,
runChangeRowReaction: boolean
preloadIsDirty?: boolean
}): any {
const rootDataView = args.rootDataView;
Expand Down Expand Up @@ -923,7 +925,9 @@ export class FormScreenLifecycle02 implements IFormScreenLifecycle02 {
}
rootDataView.restoreViewState();
} finally {
rootDataView.lifecycle.startSelectedRowReaction(!args.preloadIsDirty);
if(args.runChangeRowReaction){
rootDataView.lifecycle.startSelectedRowReaction(!args.preloadIsDirty);
}
this.monitor.inFlow--;
}
}
Expand Down Expand Up @@ -967,7 +971,8 @@ export class FormScreenLifecycle02 implements IFormScreenLifecycle02 {
do {
this._readFirstChunkOfRowsScheduled = false;
yield*this.readFirstChunkOfRows({
rootDataView: rootDataView
rootDataView: rootDataView,
runChangeRowReaction: false
});
} while (this._readFirstChunkOfRowsScheduled);
} finally {
Expand Down

0 comments on commit f12b470

Please sign in to comment.