@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 CHANGED
@@ -2756,14 +2756,19 @@ function ITDataTable({
2756
2756
  } = useTableState({ defaultItemsPerPage });
2757
2757
  const debounceTimerRef = (0, import_react11.useRef)(null);
2758
2758
  const hasFetchedRef = (0, import_react11.useRef)(false);
2759
+ const fetchDataRef = (0, import_react11.useRef)(fetchData);
2760
+ fetchDataRef.current = fetchData;
2761
+ const externalFiltersRef = (0, import_react11.useRef)(externalFilters);
2762
+ externalFiltersRef.current = externalFilters;
2763
+ const externalKey = JSON.stringify(externalFilters);
2759
2764
  const computedTotalPages = Math.ceil(totalItems / itemsPerPage) || 1;
2760
2765
  const performFetch = (0, import_react11.useCallback)(async () => {
2761
2766
  setIsLoading(true);
2762
2767
  try {
2763
- const response = await fetchData({
2768
+ const response = await fetchDataRef.current({
2764
2769
  page: currentPage,
2765
2770
  limit: itemsPerPage,
2766
- filters: { ...filters, ...externalFilters },
2771
+ filters: { ...filters, ...externalFiltersRef.current },
2767
2772
  sort: sortConfig || void 0
2768
2773
  });
2769
2774
  setData(response.data || []);
@@ -2777,17 +2782,19 @@ function ITDataTable({
2777
2782
  } finally {
2778
2783
  setIsLoading(false);
2779
2784
  }
2780
- }, [currentPage, itemsPerPage, filters, sortConfig, fetchData, externalFilters]);
2785
+ }, [currentPage, itemsPerPage, filters, sortConfig]);
2786
+ const performFetchRef = (0, import_react11.useRef)(performFetch);
2787
+ performFetchRef.current = performFetch;
2781
2788
  (0, import_react11.useEffect)(() => {
2782
2789
  if (!fetchOnMount && !hasFetchedRef.current) return;
2783
2790
  if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
2784
2791
  debounceTimerRef.current = setTimeout(() => {
2785
- performFetch();
2792
+ performFetchRef.current();
2786
2793
  }, debounceMs);
2787
2794
  return () => {
2788
2795
  if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
2789
2796
  };
2790
- }, [currentPage, itemsPerPage, sortConfig, filters, externalFilters, reloadTrigger, fetchOnMount, performFetch, debounceMs]);
2797
+ }, [currentPage, itemsPerPage, sortConfig, filters, externalKey, reloadTrigger, fetchOnMount, debounceMs]);
2791
2798
  const renderFilterInput = (col) => {
2792
2799
  if (!col.filter) return null;
2793
2800
  if (col.type === "boolean") {