@axzydev/axzy_ui_system 1.2.15 → 1.2.16
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.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/organisms/data-table/dataTable.tsx +16 -5
package/dist/index.js
CHANGED
|
@@ -2678,14 +2678,19 @@ function ITDataTable({
|
|
|
2678
2678
|
} = useTableState({ defaultItemsPerPage });
|
|
2679
2679
|
const debounceTimerRef = useRef4(null);
|
|
2680
2680
|
const hasFetchedRef = useRef4(false);
|
|
2681
|
+
const fetchDataRef = useRef4(fetchData);
|
|
2682
|
+
fetchDataRef.current = fetchData;
|
|
2683
|
+
const externalFiltersRef = useRef4(externalFilters);
|
|
2684
|
+
externalFiltersRef.current = externalFilters;
|
|
2685
|
+
const externalKey = JSON.stringify(externalFilters);
|
|
2681
2686
|
const computedTotalPages = Math.ceil(totalItems / itemsPerPage) || 1;
|
|
2682
2687
|
const performFetch = useCallback5(async () => {
|
|
2683
2688
|
setIsLoading(true);
|
|
2684
2689
|
try {
|
|
2685
|
-
const response = await
|
|
2690
|
+
const response = await fetchDataRef.current({
|
|
2686
2691
|
page: currentPage,
|
|
2687
2692
|
limit: itemsPerPage,
|
|
2688
|
-
filters: { ...filters, ...
|
|
2693
|
+
filters: { ...filters, ...externalFiltersRef.current },
|
|
2689
2694
|
sort: sortConfig || void 0
|
|
2690
2695
|
});
|
|
2691
2696
|
setData(response.data || []);
|
|
@@ -2699,17 +2704,19 @@ function ITDataTable({
|
|
|
2699
2704
|
} finally {
|
|
2700
2705
|
setIsLoading(false);
|
|
2701
2706
|
}
|
|
2702
|
-
}, [currentPage, itemsPerPage, filters, sortConfig
|
|
2707
|
+
}, [currentPage, itemsPerPage, filters, sortConfig]);
|
|
2708
|
+
const performFetchRef = useRef4(performFetch);
|
|
2709
|
+
performFetchRef.current = performFetch;
|
|
2703
2710
|
useEffect5(() => {
|
|
2704
2711
|
if (!fetchOnMount && !hasFetchedRef.current) return;
|
|
2705
2712
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
2706
2713
|
debounceTimerRef.current = setTimeout(() => {
|
|
2707
|
-
|
|
2714
|
+
performFetchRef.current();
|
|
2708
2715
|
}, debounceMs);
|
|
2709
2716
|
return () => {
|
|
2710
2717
|
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
2711
2718
|
};
|
|
2712
|
-
}, [currentPage, itemsPerPage, sortConfig, filters,
|
|
2719
|
+
}, [currentPage, itemsPerPage, sortConfig, filters, externalKey, reloadTrigger, fetchOnMount, debounceMs]);
|
|
2713
2720
|
const renderFilterInput = (col) => {
|
|
2714
2721
|
if (!col.filter) return null;
|
|
2715
2722
|
if (col.type === "boolean") {
|