@axzydev/axzy_ui_system 1.2.14 → 1.2.15
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/index.js
CHANGED
|
@@ -2677,6 +2677,7 @@ function ITDataTable({
|
|
|
2677
2677
|
handleItemsPerPageChange
|
|
2678
2678
|
} = useTableState({ defaultItemsPerPage });
|
|
2679
2679
|
const debounceTimerRef = useRef4(null);
|
|
2680
|
+
const hasFetchedRef = useRef4(false);
|
|
2680
2681
|
const computedTotalPages = Math.ceil(totalItems / itemsPerPage) || 1;
|
|
2681
2682
|
const performFetch = useCallback5(async () => {
|
|
2682
2683
|
setIsLoading(true);
|
|
@@ -2689,16 +2690,18 @@ function ITDataTable({
|
|
|
2689
2690
|
});
|
|
2690
2691
|
setData(response.data || []);
|
|
2691
2692
|
setTotalItems(response.total || 0);
|
|
2693
|
+
hasFetchedRef.current = true;
|
|
2692
2694
|
} catch (error) {
|
|
2693
2695
|
console.error("ITDataTable: Error fetching data", error);
|
|
2694
2696
|
setData([]);
|
|
2695
2697
|
setTotalItems(0);
|
|
2698
|
+
hasFetchedRef.current = true;
|
|
2696
2699
|
} finally {
|
|
2697
2700
|
setIsLoading(false);
|
|
2698
2701
|
}
|
|
2699
2702
|
}, [currentPage, itemsPerPage, filters, sortConfig, fetchData, externalFilters]);
|
|
2700
2703
|
useEffect5(() => {
|
|
2701
|
-
if (!fetchOnMount &&
|
|
2704
|
+
if (!fetchOnMount && !hasFetchedRef.current) return;
|
|
2702
2705
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
2703
2706
|
debounceTimerRef.current = setTimeout(() => {
|
|
2704
2707
|
performFetch();
|
|
@@ -2706,7 +2709,7 @@ function ITDataTable({
|
|
|
2706
2709
|
return () => {
|
|
2707
2710
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
2708
2711
|
};
|
|
2709
|
-
}, [currentPage, itemsPerPage, sortConfig, filters, externalFilters, reloadTrigger, fetchOnMount, performFetch,
|
|
2712
|
+
}, [currentPage, itemsPerPage, sortConfig, filters, externalFilters, reloadTrigger, fetchOnMount, performFetch, debounceMs]);
|
|
2710
2713
|
const renderFilterInput = (col) => {
|
|
2711
2714
|
if (!col.filter) return null;
|
|
2712
2715
|
if (col.type === "boolean") {
|