pixelize-design-library 2.3.1-beta.6 → 2.3.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Table/Table.js +23 -14
- package/package.json +1 -1
|
@@ -43,6 +43,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
45
|
})();
|
|
46
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
47
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
48
|
+
if (ar || !(i in from)) {
|
|
49
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
50
|
+
ar[i] = from[i];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
54
|
+
};
|
|
46
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
57
|
};
|
|
@@ -139,22 +148,22 @@ function Table(_a) {
|
|
|
139
148
|
(0, react_1.useEffect)(function () {
|
|
140
149
|
if (!groupLoadMore)
|
|
141
150
|
return;
|
|
142
|
-
if (pendingLoadMoreRef.current) {
|
|
143
|
-
|
|
144
|
-
setAccumulatedRows(function (prev) {
|
|
145
|
-
var seen = new Set(prev.map(function (r) { return r.id; }));
|
|
146
|
-
var merged = prev.slice();
|
|
147
|
-
for (var _i = 0, tableData_1 = tableData; _i < tableData_1.length; _i++) {
|
|
148
|
-
var r = tableData_1[_i];
|
|
149
|
-
if (!seen.has(r.id))
|
|
150
|
-
merged.push(r);
|
|
151
|
-
}
|
|
152
|
-
return merged;
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
151
|
+
if (!pendingLoadMoreRef.current) {
|
|
152
|
+
// Fresh load (initial / search / filter / sort / page-size) → reset.
|
|
156
153
|
setAccumulatedRows(tableData);
|
|
154
|
+
return;
|
|
157
155
|
}
|
|
156
|
+
// A "Load more" is in flight. The parent may re-emit the SAME page (new array
|
|
157
|
+
// reference) on intermediate re-renders before the next page actually arrives,
|
|
158
|
+
// so only consume the pending flag once genuinely new rows (by id) show up.
|
|
159
|
+
setAccumulatedRows(function (prev) {
|
|
160
|
+
var seen = new Set(prev.map(function (r) { return r.id; }));
|
|
161
|
+
var newRows = tableData.filter(function (r) { return !seen.has(r.id); });
|
|
162
|
+
if (newRows.length === 0)
|
|
163
|
+
return prev; // same page re-emitted — keep waiting
|
|
164
|
+
pendingLoadMoreRef.current = false;
|
|
165
|
+
return __spreadArray(__spreadArray([], prev, true), newRows, true);
|
|
166
|
+
});
|
|
158
167
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
168
|
}, [tableData, groupLoadMore]);
|
|
160
169
|
(0, react_1.useEffect)(function () {
|