Skip to content

Commit 10a3a0b

Browse files
committed
fix sorting twice when recieve props
1 parent 4739d43 commit 10a3a0b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/store/TableDataStore.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class TableDataStore {
6363
return;
6464
}
6565

66-
this._refresh();
66+
this._refresh(true);
6767
}
6868

6969
getColInfos() {
@@ -101,12 +101,12 @@ export class TableDataStore {
101101
else return this.data;
102102
}
103103

104-
_refresh() {
104+
_refresh(skipSorting) {
105105
if (this.isOnFilter) {
106106
if (this.filterObj !== null) this.filter(this.filterObj);
107107
if (this.searchText !== null) this.search(this.searchText);
108108
}
109-
if (this.sortObj) {
109+
if (!skipSorting && this.sortObj) {
110110
this.sort(this.sortObj.order, this.sortObj.sortField);
111111
}
112112
}
@@ -178,7 +178,7 @@ export class TableDataStore {
178178
if (this.isOnFilter) {
179179
this.data.unshift(newObj);
180180
}
181-
this._refresh();
181+
this._refresh(false);
182182
}
183183

184184
add(newObj) {
@@ -196,7 +196,7 @@ export class TableDataStore {
196196
if (this.isOnFilter) {
197197
this.data.push(newObj);
198198
}
199-
this._refresh();
199+
this._refresh(false);
200200
}
201201

202202
remove(rowKey) {

0 commit comments

Comments
 (0)