@facter/ds-core 1.18.0 → 1.19.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/index.mjs CHANGED
@@ -1625,21 +1625,21 @@ var DataTableSearch = React10.memo(function DataTableSearch2({
1625
1625
  columnInstance?.getFilterValue() ?? ""
1626
1626
  );
1627
1627
  const debouncedValue = useDebounce(value, debounce);
1628
+ const isServerSide = !!onSearch;
1628
1629
  React10.useEffect(() => {
1629
- if (columnInstance) {
1630
- columnInstance.setFilterValue(debouncedValue || void 0);
1631
- }
1632
- if (onSearch) {
1630
+ if (isServerSide) {
1633
1631
  onSearch(debouncedValue);
1632
+ } else if (columnInstance) {
1633
+ columnInstance.setFilterValue(debouncedValue || void 0);
1634
1634
  }
1635
- }, [debouncedValue, columnInstance, onSearch]);
1635
+ }, [debouncedValue, columnInstance, onSearch, isServerSide]);
1636
1636
  React10.useEffect(() => {
1637
- if (!columnInstance) return;
1637
+ if (isServerSide || !columnInstance) return;
1638
1638
  const filterValue = columnInstance.getFilterValue() ?? "";
1639
1639
  if (filterValue !== value) {
1640
1640
  setValue(filterValue);
1641
1641
  }
1642
- }, [columnInstance?.getFilterValue()]);
1642
+ }, [columnInstance?.getFilterValue(), isServerSide]);
1643
1643
  return /* @__PURE__ */ jsxs("div", { className: cn("relative w-[150px] lg:w-[250px]", className), children: [
1644
1644
  /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" }),
1645
1645
  /* @__PURE__ */ jsx(