@economic/taco 2.64.0 → 2.64.1-table-flickering.0
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/taco.cjs +13 -13
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +13 -13
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -88413,19 +88413,16 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
|
|
88413
88413
|
const _lastUsedSearch = React.useRef();
|
88414
88414
|
async function loadPage(pageIndex, sorting, filters, hiddenColumns, search) {
|
88415
88415
|
const hasDataChanged = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || JSON.stringify(hiddenColumns) !== JSON.stringify(_lastUsedHiddenColumns.current) || search !== _lastUsedSearch.current;
|
88416
|
+
const isAlreadyLoadedOrLoading = _pendingPageRequests.current[pageIndex] || data.cache[pageIndex] && data.cache[pageIndex][0];
|
88417
|
+
if (!hasDataChanged && isAlreadyLoadedOrLoading) {
|
88418
|
+
return;
|
88419
|
+
}
|
88416
88420
|
if (hasDataChanged) {
|
88417
88421
|
_lastUsedSorting.current = sorting;
|
88418
88422
|
_lastUsedFilters.current = filters;
|
88419
88423
|
_lastUsedSearch.current = search;
|
88420
88424
|
_lastUsedHiddenColumns.current = hiddenColumns;
|
88421
88425
|
_pendingPageRequests.current = {};
|
88422
|
-
} else {
|
88423
|
-
if (_pendingPageRequests.current[pageIndex]) {
|
88424
|
-
return;
|
88425
|
-
}
|
88426
|
-
if (data.cache[pageIndex] && data.cache[pageIndex][0]) {
|
88427
|
-
return;
|
88428
|
-
}
|
88429
88426
|
}
|
88430
88427
|
const dataKey = getDataKey(sorting, filters, hiddenColumns, search);
|
88431
88428
|
_pendingPageRequests.current[pageIndex] = dataKey;
|
@@ -88471,6 +88468,7 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
|
|
88471
88468
|
delete _pendingPageRequests.current[pageIndex];
|
88472
88469
|
});
|
88473
88470
|
} catch {
|
88471
|
+
delete _pendingPageRequests.current[pageIndex];
|
88474
88472
|
}
|
88475
88473
|
}
|
88476
88474
|
const loadAll = async (sorting, filters, hiddenColumns, search) => {
|
@@ -88580,12 +88578,14 @@ function getCurrentPage(currentPages) {
|
|
88580
88578
|
return currentPages[middle];
|
88581
88579
|
}
|
88582
88580
|
function getDirection(pageIndex, currentPages) {
|
88583
|
-
if (currentPages.length) {
|
88584
|
-
|
88585
|
-
|
88586
|
-
|
88587
|
-
|
88588
|
-
|
88581
|
+
if (!currentPages.length) {
|
88582
|
+
return void 0;
|
88583
|
+
}
|
88584
|
+
if (pageIndex === currentPages[currentPages.length - 1] + 1) {
|
88585
|
+
return "forward";
|
88586
|
+
}
|
88587
|
+
if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
|
88588
|
+
return "backward";
|
88589
88589
|
}
|
88590
88590
|
return void 0;
|
88591
88591
|
}
|