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

FIX: Redundant master record calls avoided #1836

Merged
merged 4 commits into from Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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