@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.js
CHANGED
@@ -88395,19 +88395,16 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
|
|
88395
88395
|
const _lastUsedSearch = React__default.useRef();
|
88396
88396
|
async function loadPage(pageIndex, sorting, filters, hiddenColumns, search) {
|
88397
88397
|
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;
|
88398
|
+
const isAlreadyLoadedOrLoading = _pendingPageRequests.current[pageIndex] || data.cache[pageIndex] && data.cache[pageIndex][0];
|
88399
|
+
if (!hasDataChanged && isAlreadyLoadedOrLoading) {
|
88400
|
+
return;
|
88401
|
+
}
|
88398
88402
|
if (hasDataChanged) {
|
88399
88403
|
_lastUsedSorting.current = sorting;
|
88400
88404
|
_lastUsedFilters.current = filters;
|
88401
88405
|
_lastUsedSearch.current = search;
|
88402
88406
|
_lastUsedHiddenColumns.current = hiddenColumns;
|
88403
88407
|
_pendingPageRequests.current = {};
|
88404
|
-
} else {
|
88405
|
-
if (_pendingPageRequests.current[pageIndex]) {
|
88406
|
-
return;
|
88407
|
-
}
|
88408
|
-
if (data.cache[pageIndex] && data.cache[pageIndex][0]) {
|
88409
|
-
return;
|
88410
|
-
}
|
88411
88408
|
}
|
88412
88409
|
const dataKey = getDataKey(sorting, filters, hiddenColumns, search);
|
88413
88410
|
_pendingPageRequests.current[pageIndex] = dataKey;
|
@@ -88453,6 +88450,7 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
|
|
88453
88450
|
delete _pendingPageRequests.current[pageIndex];
|
88454
88451
|
});
|
88455
88452
|
} catch {
|
88453
|
+
delete _pendingPageRequests.current[pageIndex];
|
88456
88454
|
}
|
88457
88455
|
}
|
88458
88456
|
const loadAll = async (sorting, filters, hiddenColumns, search) => {
|
@@ -88562,12 +88560,14 @@ function getCurrentPage(currentPages) {
|
|
88562
88560
|
return currentPages[middle];
|
88563
88561
|
}
|
88564
88562
|
function getDirection(pageIndex, currentPages) {
|
88565
|
-
if (currentPages.length) {
|
88566
|
-
|
88567
|
-
|
88568
|
-
|
88569
|
-
|
88570
|
-
|
88563
|
+
if (!currentPages.length) {
|
88564
|
+
return void 0;
|
88565
|
+
}
|
88566
|
+
if (pageIndex === currentPages[currentPages.length - 1] + 1) {
|
88567
|
+
return "forward";
|
88568
|
+
}
|
88569
|
+
if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
|
88570
|
+
return "backward";
|
88571
88571
|
}
|
88572
88572
|
return void 0;
|
88573
88573
|
}
|