@addsign/moje-agenda-shared-lib 1.0.9 → 1.0.11

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.
@@ -21698,6 +21698,7 @@ function DataTableServer({
21698
21698
  const federationContext = useFederationContext();
21699
21699
  const [data, setData] = useState();
21700
21700
  const [isLoading, setIsLoading] = useState(false);
21701
+ const [isLocalStorageLoaded, setIsLocalStorageLoaded] = useState(false);
21701
21702
  const [tableKey, setTableKey] = useState(0);
21702
21703
  const [currentPage, setCurrentPage] = useState();
21703
21704
  const [selectedItems, setSelectedItems] = useState([]);
@@ -21804,6 +21805,7 @@ function DataTableServer({
21804
21805
  setSortConfig(null);
21805
21806
  setItemsPerPageLocal(storageObject.itemsPerPage || 10);
21806
21807
  }
21808
+ setIsLocalStorageLoaded(true);
21807
21809
  }
21808
21810
  }, [id]);
21809
21811
  useEffect(() => {
@@ -21912,7 +21914,7 @@ function DataTableServer({
21912
21914
  setShowColFilters(!showColFilters);
21913
21915
  };
21914
21916
  useEffect(() => {
21915
- if (id) {
21917
+ if (id && isLocalStorageLoaded) {
21916
21918
  const storageKey = `datatable:${id}`;
21917
21919
  const storageObject = localStorage.getItem(
21918
21920
  storageKey
@@ -21921,11 +21923,18 @@ function DataTableServer({
21921
21923
  ) : {};
21922
21924
  storageObject.columnFilters = columnFilters || {};
21923
21925
  storageObject.showColFilters = showColFilters || false;
21924
- storageObject.currentPage = currentPage !== void 0 ? currentPage : storageObject.currentPage || 0;
21925
- storageObject.itemsPerPage = itemsPerPageLocal || storageObject.itemsPerPage;
21926
+ storageObject.currentPage = currentPage || 0;
21927
+ storageObject.itemsPerPage = itemsPerPageLocal || 10;
21926
21928
  localStorage.setItem(storageKey, JSON.stringify(storageObject));
21927
21929
  }
21928
- }, [columnFilters, showColFilters, currentPage, id, itemsPerPageLocal]);
21930
+ }, [
21931
+ columnFilters,
21932
+ showColFilters,
21933
+ currentPage,
21934
+ id,
21935
+ itemsPerPageLocal,
21936
+ isLocalStorageLoaded
21937
+ ]);
21929
21938
  const rerenderTable = () => {
21930
21939
  setTableKey((previous) => previous + 1);
21931
21940
  };
@@ -21982,7 +21991,6 @@ function DataTableServer({
21982
21991
  setItemsPerPageLocal(selectedItemsPerPage);
21983
21992
  setCurrentPage(0);
21984
21993
  };
21985
- console.log("mergedFilters", mergedFilters);
21986
21994
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
21987
21995
  "div",
21988
21996
  {
@@ -22094,7 +22102,7 @@ function DataTableServer({
22094
22102
  ),
22095
22103
  type: filterType,
22096
22104
  options: filterOptions[String(filterParam)] || [],
22097
- value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22105
+ value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) ?? "",
22098
22106
  clearable: true,
22099
22107
  className: " px-0",
22100
22108
  placeholder: "Zadejte filtr",