@procore/saved-views 5.0.0-alpha.5 → 5.0.0-alpha.6

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.
@@ -3976,7 +3976,7 @@ var require_lodash = __commonJS({
3976
3976
  if (typeof func != "function") {
3977
3977
  throw new TypeError2(FUNC_ERROR_TEXT);
3978
3978
  }
3979
- return setTimeout(function() {
3979
+ return setTimeout2(function() {
3980
3980
  func.apply(undefined2, args);
3981
3981
  }, wait);
3982
3982
  }
@@ -5807,7 +5807,7 @@ var require_lodash = __commonJS({
5807
5807
  return object2[key];
5808
5808
  }
5809
5809
  var setData = shortOut(baseSetData);
5810
- var setTimeout = ctxSetTimeout || function(func, wait) {
5810
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5811
5811
  return root.setTimeout(func, wait);
5812
5812
  };
5813
5813
  var setToString = shortOut(baseSetToString);
@@ -6599,7 +6599,7 @@ var require_lodash = __commonJS({
6599
6599
  }
6600
6600
  function leadingEdge(time) {
6601
6601
  lastInvokeTime = time;
6602
- timerId = setTimeout(timerExpired, wait);
6602
+ timerId = setTimeout2(timerExpired, wait);
6603
6603
  return leading ? invokeFunc(time) : result2;
6604
6604
  }
6605
6605
  function remainingWait(time) {
@@ -6615,7 +6615,7 @@ var require_lodash = __commonJS({
6615
6615
  if (shouldInvoke(time)) {
6616
6616
  return trailingEdge(time);
6617
6617
  }
6618
- timerId = setTimeout(timerExpired, remainingWait(time));
6618
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6619
6619
  }
6620
6620
  function trailingEdge(time) {
6621
6621
  timerId = undefined2;
@@ -6646,12 +6646,12 @@ var require_lodash = __commonJS({
6646
6646
  }
6647
6647
  if (maxing) {
6648
6648
  clearTimeout(timerId);
6649
- timerId = setTimeout(timerExpired, wait);
6649
+ timerId = setTimeout2(timerExpired, wait);
6650
6650
  return invokeFunc(lastCallTime);
6651
6651
  }
6652
6652
  }
6653
6653
  if (timerId === undefined2) {
6654
- timerId = setTimeout(timerExpired, wait);
6654
+ timerId = setTimeout2(timerExpired, wait);
6655
6655
  }
6656
6656
  return result2;
6657
6657
  }
@@ -11442,11 +11442,6 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11442
11442
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11443
11443
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11444
11444
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11445
- console.log("xx:Difference between view config and current config:", {
11446
- viewConfig: cleanedViewConfig,
11447
- currentConfig: cleanedCurrentConfig,
11448
- areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11449
- });
11450
11445
  return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11451
11446
  };
11452
11447
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
@@ -11684,10 +11679,14 @@ var useSmartGridConfig = (gridApi) => {
11684
11679
  const [config, setConfig] = (0, import_react10.useState)(
11685
11680
  () => getSmartGridConfig(gridApi)
11686
11681
  );
11682
+ const eventListenersDisabledRef = (0, import_react10.useRef)(false);
11687
11683
  (0, import_react10.useEffect)(() => {
11688
11684
  if (!gridApi)
11689
11685
  return;
11690
- const updateConfig = () => {
11686
+ const updateConfig = (par) => {
11687
+ if (eventListenersDisabledRef.current) {
11688
+ return;
11689
+ }
11691
11690
  setConfig(getSmartGridConfig(gridApi));
11692
11691
  };
11693
11692
  GRID_STATE_EVENTS.forEach((event) => {
@@ -11699,7 +11698,13 @@ var useSmartGridConfig = (gridApi) => {
11699
11698
  });
11700
11699
  };
11701
11700
  }, [gridApi]);
11702
- return { config, setConfig };
11701
+ const disableEventListeners = () => {
11702
+ eventListenersDisabledRef.current = true;
11703
+ };
11704
+ const enableEventListeners = () => {
11705
+ eventListenersDisabledRef.current = false;
11706
+ };
11707
+ return { config, setConfig, disableEventListeners, enableEventListeners };
11703
11708
  };
11704
11709
 
11705
11710
  // src/SavedViews/components/SavedViews/SavedViews.tsx
@@ -14064,7 +14069,7 @@ function extractMessage(error, I18n) {
14064
14069
  }
14065
14070
 
14066
14071
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14067
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14072
+ var { useEffect: useEffect3, useRef: useRef3 } = React17;
14068
14073
  var ScrollContainer = styled_components_esm_default("div")`
14069
14074
  overflow: auto;
14070
14075
  `;
@@ -14087,7 +14092,7 @@ var SavedViewsCreateUpdateModalBase = ({
14087
14092
  }) => {
14088
14093
  const I18n = (0, import_core_react9.useI18nContext)();
14089
14094
  const NAME_MAX_LENGTH = 150;
14090
- const originalBodyWidth = useRef2("");
14095
+ const originalBodyWidth = useRef3("");
14091
14096
  useEffect3(() => {
14092
14097
  if (open) {
14093
14098
  originalBodyWidth.current = document.body.style.width || "";
@@ -14598,7 +14603,12 @@ var SavedViews = (props) => {
14598
14603
  var import_toast_alert2 = require("@procore/toast-alert");
14599
14604
  var SmartGridSavedViews = (props) => {
14600
14605
  const { gridApi, projectId, companyId } = props;
14601
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
14606
+ const {
14607
+ config: tableConfig,
14608
+ setConfig: setTableConfig,
14609
+ disableEventListeners,
14610
+ enableEventListeners
14611
+ } = useSmartGridConfig(gridApi);
14602
14612
  const defaultView = useDefaultView({
14603
14613
  defaultViewName: props.defaultViewName,
14604
14614
  domain: props.domain
@@ -14624,8 +14634,15 @@ var SmartGridSavedViews = (props) => {
14624
14634
  tableConfig2
14625
14635
  )
14626
14636
  };
14627
- updateTableConfig(updatedView, gridApi, "smart-grid");
14628
- setTableConfig(updatedView.table_config);
14637
+ disableEventListeners();
14638
+ try {
14639
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14640
+ setTableConfig(updatedView.table_config);
14641
+ } finally {
14642
+ setTimeout(() => {
14643
+ enableEventListeners();
14644
+ }, 0);
14645
+ }
14629
14646
  return updatedView;
14630
14647
  };
14631
14648
  return /* @__PURE__ */ import_react14.default.createElement(import_toast_alert2.ToastAlertProvider, null, /* @__PURE__ */ import_react14.default.createElement(
@@ -3982,7 +3982,7 @@ var require_lodash = __commonJS({
3982
3982
  if (typeof func != "function") {
3983
3983
  throw new TypeError2(FUNC_ERROR_TEXT);
3984
3984
  }
3985
- return setTimeout(function() {
3985
+ return setTimeout2(function() {
3986
3986
  func.apply(undefined2, args);
3987
3987
  }, wait);
3988
3988
  }
@@ -5813,7 +5813,7 @@ var require_lodash = __commonJS({
5813
5813
  return object2[key];
5814
5814
  }
5815
5815
  var setData = shortOut(baseSetData);
5816
- var setTimeout = ctxSetTimeout || function(func, wait) {
5816
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5817
5817
  return root.setTimeout(func, wait);
5818
5818
  };
5819
5819
  var setToString = shortOut(baseSetToString);
@@ -6605,7 +6605,7 @@ var require_lodash = __commonJS({
6605
6605
  }
6606
6606
  function leadingEdge(time) {
6607
6607
  lastInvokeTime = time;
6608
- timerId = setTimeout(timerExpired, wait);
6608
+ timerId = setTimeout2(timerExpired, wait);
6609
6609
  return leading ? invokeFunc(time) : result2;
6610
6610
  }
6611
6611
  function remainingWait(time) {
@@ -6621,7 +6621,7 @@ var require_lodash = __commonJS({
6621
6621
  if (shouldInvoke(time)) {
6622
6622
  return trailingEdge(time);
6623
6623
  }
6624
- timerId = setTimeout(timerExpired, remainingWait(time));
6624
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6625
6625
  }
6626
6626
  function trailingEdge(time) {
6627
6627
  timerId = undefined2;
@@ -6652,12 +6652,12 @@ var require_lodash = __commonJS({
6652
6652
  }
6653
6653
  if (maxing) {
6654
6654
  clearTimeout(timerId);
6655
- timerId = setTimeout(timerExpired, wait);
6655
+ timerId = setTimeout2(timerExpired, wait);
6656
6656
  return invokeFunc(lastCallTime);
6657
6657
  }
6658
6658
  }
6659
6659
  if (timerId === undefined2) {
6660
- timerId = setTimeout(timerExpired, wait);
6660
+ timerId = setTimeout2(timerExpired, wait);
6661
6661
  }
6662
6662
  return result2;
6663
6663
  }
@@ -11446,11 +11446,6 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11446
11446
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11447
11447
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11448
11448
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11449
- console.log("xx:Difference between view config and current config:", {
11450
- viewConfig: cleanedViewConfig,
11451
- currentConfig: cleanedCurrentConfig,
11452
- areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11453
- });
11454
11449
  return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11455
11450
  };
11456
11451
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
@@ -11675,7 +11670,7 @@ var useDefaultView = (props) => {
11675
11670
  };
11676
11671
 
11677
11672
  // src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
11678
- import { useState as useState3, useEffect as useEffect2 } from "react";
11673
+ import { useState as useState3, useEffect as useEffect2, useRef as useRef2 } from "react";
11679
11674
  var GRID_STATE_EVENTS = [
11680
11675
  "sortChanged",
11681
11676
  "filterOpened",
@@ -11694,10 +11689,14 @@ var useSmartGridConfig = (gridApi) => {
11694
11689
  const [config, setConfig] = useState3(
11695
11690
  () => getSmartGridConfig(gridApi)
11696
11691
  );
11692
+ const eventListenersDisabledRef = useRef2(false);
11697
11693
  useEffect2(() => {
11698
11694
  if (!gridApi)
11699
11695
  return;
11700
- const updateConfig = () => {
11696
+ const updateConfig = (par) => {
11697
+ if (eventListenersDisabledRef.current) {
11698
+ return;
11699
+ }
11701
11700
  setConfig(getSmartGridConfig(gridApi));
11702
11701
  };
11703
11702
  GRID_STATE_EVENTS.forEach((event) => {
@@ -11709,7 +11708,13 @@ var useSmartGridConfig = (gridApi) => {
11709
11708
  });
11710
11709
  };
11711
11710
  }, [gridApi]);
11712
- return { config, setConfig };
11711
+ const disableEventListeners = () => {
11712
+ eventListenersDisabledRef.current = true;
11713
+ };
11714
+ const enableEventListeners = () => {
11715
+ eventListenersDisabledRef.current = false;
11716
+ };
11717
+ return { config, setConfig, disableEventListeners, enableEventListeners };
11713
11718
  };
11714
11719
 
11715
11720
  // src/SavedViews/components/SavedViews/SavedViews.tsx
@@ -14099,7 +14104,7 @@ function extractMessage(error, I18n) {
14099
14104
  }
14100
14105
 
14101
14106
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14102
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14107
+ var { useEffect: useEffect3, useRef: useRef3 } = React17;
14103
14108
  var ScrollContainer = styled_components_esm_default("div")`
14104
14109
  overflow: auto;
14105
14110
  `;
@@ -14122,7 +14127,7 @@ var SavedViewsCreateUpdateModalBase = ({
14122
14127
  }) => {
14123
14128
  const I18n = useI18nContext7();
14124
14129
  const NAME_MAX_LENGTH = 150;
14125
- const originalBodyWidth = useRef2("");
14130
+ const originalBodyWidth = useRef3("");
14126
14131
  useEffect3(() => {
14127
14132
  if (open) {
14128
14133
  originalBodyWidth.current = document.body.style.width || "";
@@ -14633,7 +14638,12 @@ var SavedViews = (props) => {
14633
14638
  import { ToastAlertProvider } from "@procore/toast-alert";
14634
14639
  var SmartGridSavedViews = (props) => {
14635
14640
  const { gridApi, projectId, companyId } = props;
14636
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
14641
+ const {
14642
+ config: tableConfig,
14643
+ setConfig: setTableConfig,
14644
+ disableEventListeners,
14645
+ enableEventListeners
14646
+ } = useSmartGridConfig(gridApi);
14637
14647
  const defaultView = useDefaultView({
14638
14648
  defaultViewName: props.defaultViewName,
14639
14649
  domain: props.domain
@@ -14659,8 +14669,15 @@ var SmartGridSavedViews = (props) => {
14659
14669
  tableConfig2
14660
14670
  )
14661
14671
  };
14662
- updateTableConfig(updatedView, gridApi, "smart-grid");
14663
- setTableConfig(updatedView.table_config);
14672
+ disableEventListeners();
14673
+ try {
14674
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14675
+ setTableConfig(updatedView.table_config);
14676
+ } finally {
14677
+ setTimeout(() => {
14678
+ enableEventListeners();
14679
+ }, 0);
14680
+ }
14664
14681
  return updatedView;
14665
14682
  };
14666
14683
  return /* @__PURE__ */ React20.createElement(ToastAlertProvider, null, /* @__PURE__ */ React20.createElement(
@@ -3976,7 +3976,7 @@ var require_lodash = __commonJS({
3976
3976
  if (typeof func != "function") {
3977
3977
  throw new TypeError2(FUNC_ERROR_TEXT);
3978
3978
  }
3979
- return setTimeout(function() {
3979
+ return setTimeout2(function() {
3980
3980
  func.apply(undefined2, args);
3981
3981
  }, wait);
3982
3982
  }
@@ -5807,7 +5807,7 @@ var require_lodash = __commonJS({
5807
5807
  return object2[key];
5808
5808
  }
5809
5809
  var setData = shortOut(baseSetData);
5810
- var setTimeout = ctxSetTimeout || function(func, wait) {
5810
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5811
5811
  return root.setTimeout(func, wait);
5812
5812
  };
5813
5813
  var setToString = shortOut(baseSetToString);
@@ -6599,7 +6599,7 @@ var require_lodash = __commonJS({
6599
6599
  }
6600
6600
  function leadingEdge(time) {
6601
6601
  lastInvokeTime = time;
6602
- timerId = setTimeout(timerExpired, wait);
6602
+ timerId = setTimeout2(timerExpired, wait);
6603
6603
  return leading ? invokeFunc(time) : result2;
6604
6604
  }
6605
6605
  function remainingWait(time) {
@@ -6615,7 +6615,7 @@ var require_lodash = __commonJS({
6615
6615
  if (shouldInvoke(time)) {
6616
6616
  return trailingEdge(time);
6617
6617
  }
6618
- timerId = setTimeout(timerExpired, remainingWait(time));
6618
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6619
6619
  }
6620
6620
  function trailingEdge(time) {
6621
6621
  timerId = undefined2;
@@ -6646,12 +6646,12 @@ var require_lodash = __commonJS({
6646
6646
  }
6647
6647
  if (maxing) {
6648
6648
  clearTimeout(timerId);
6649
- timerId = setTimeout(timerExpired, wait);
6649
+ timerId = setTimeout2(timerExpired, wait);
6650
6650
  return invokeFunc(lastCallTime);
6651
6651
  }
6652
6652
  }
6653
6653
  if (timerId === undefined2) {
6654
- timerId = setTimeout(timerExpired, wait);
6654
+ timerId = setTimeout2(timerExpired, wait);
6655
6655
  }
6656
6656
  return result2;
6657
6657
  }
@@ -11440,11 +11440,6 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11440
11440
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11441
11441
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11442
11442
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11443
- console.log("xx:Difference between view config and current config:", {
11444
- viewConfig: cleanedViewConfig,
11445
- currentConfig: cleanedCurrentConfig,
11446
- areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11447
- });
11448
11443
  return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11449
11444
  };
11450
11445
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
@@ -11680,10 +11675,14 @@ var useSmartGridConfig = (gridApi) => {
11680
11675
  const [config, setConfig] = (0, import_react10.useState)(
11681
11676
  () => getSmartGridConfig(gridApi)
11682
11677
  );
11678
+ const eventListenersDisabledRef = (0, import_react10.useRef)(false);
11683
11679
  (0, import_react10.useEffect)(() => {
11684
11680
  if (!gridApi)
11685
11681
  return;
11686
- const updateConfig = () => {
11682
+ const updateConfig = (par) => {
11683
+ if (eventListenersDisabledRef.current) {
11684
+ return;
11685
+ }
11687
11686
  setConfig(getSmartGridConfig(gridApi));
11688
11687
  };
11689
11688
  GRID_STATE_EVENTS.forEach((event) => {
@@ -11695,7 +11694,13 @@ var useSmartGridConfig = (gridApi) => {
11695
11694
  });
11696
11695
  };
11697
11696
  }, [gridApi]);
11698
- return { config, setConfig };
11697
+ const disableEventListeners = () => {
11698
+ eventListenersDisabledRef.current = true;
11699
+ };
11700
+ const enableEventListeners = () => {
11701
+ eventListenersDisabledRef.current = false;
11702
+ };
11703
+ return { config, setConfig, disableEventListeners, enableEventListeners };
11699
11704
  };
11700
11705
 
11701
11706
  // src/SavedViews/components/SavedViews/SavedViews.tsx
@@ -14060,7 +14065,7 @@ function extractMessage(error, I18n) {
14060
14065
  }
14061
14066
 
14062
14067
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14063
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14068
+ var { useEffect: useEffect3, useRef: useRef3 } = React17;
14064
14069
  var ScrollContainer = styled_components_esm_default("div")`
14065
14070
  overflow: auto;
14066
14071
  `;
@@ -14083,7 +14088,7 @@ var SavedViewsCreateUpdateModalBase = ({
14083
14088
  }) => {
14084
14089
  const I18n = (0, import_core_react9.useI18nContext)();
14085
14090
  const NAME_MAX_LENGTH = 150;
14086
- const originalBodyWidth = useRef2("");
14091
+ const originalBodyWidth = useRef3("");
14087
14092
  useEffect3(() => {
14088
14093
  if (open) {
14089
14094
  originalBodyWidth.current = document.body.style.width || "";
@@ -14594,7 +14599,12 @@ var SavedViews = (props) => {
14594
14599
  var import_toast_alert2 = require("@procore/toast-alert");
14595
14600
  var SmartGridSavedViews = (props) => {
14596
14601
  const { gridApi, projectId, companyId } = props;
14597
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
14602
+ const {
14603
+ config: tableConfig,
14604
+ setConfig: setTableConfig,
14605
+ disableEventListeners,
14606
+ enableEventListeners
14607
+ } = useSmartGridConfig(gridApi);
14598
14608
  const defaultView = useDefaultView({
14599
14609
  defaultViewName: props.defaultViewName,
14600
14610
  domain: props.domain
@@ -14619,8 +14629,15 @@ var SmartGridSavedViews = (props) => {
14619
14629
  tableConfig2
14620
14630
  )
14621
14631
  };
14622
- updateTableConfig(updatedView, gridApi, "smart-grid");
14623
- setTableConfig(updatedView.table_config);
14632
+ disableEventListeners();
14633
+ try {
14634
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14635
+ setTableConfig(updatedView.table_config);
14636
+ } finally {
14637
+ setTimeout(() => {
14638
+ enableEventListeners();
14639
+ }, 0);
14640
+ }
14624
14641
  return updatedView;
14625
14642
  };
14626
14643
  return /* @__PURE__ */ import_react14.default.createElement(import_toast_alert2.ToastAlertProvider, null, /* @__PURE__ */ import_react14.default.createElement(
@@ -3982,7 +3982,7 @@ var require_lodash = __commonJS({
3982
3982
  if (typeof func != "function") {
3983
3983
  throw new TypeError2(FUNC_ERROR_TEXT);
3984
3984
  }
3985
- return setTimeout(function() {
3985
+ return setTimeout2(function() {
3986
3986
  func.apply(undefined2, args);
3987
3987
  }, wait);
3988
3988
  }
@@ -5813,7 +5813,7 @@ var require_lodash = __commonJS({
5813
5813
  return object2[key];
5814
5814
  }
5815
5815
  var setData = shortOut(baseSetData);
5816
- var setTimeout = ctxSetTimeout || function(func, wait) {
5816
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
5817
5817
  return root.setTimeout(func, wait);
5818
5818
  };
5819
5819
  var setToString = shortOut(baseSetToString);
@@ -6605,7 +6605,7 @@ var require_lodash = __commonJS({
6605
6605
  }
6606
6606
  function leadingEdge(time) {
6607
6607
  lastInvokeTime = time;
6608
- timerId = setTimeout(timerExpired, wait);
6608
+ timerId = setTimeout2(timerExpired, wait);
6609
6609
  return leading ? invokeFunc(time) : result2;
6610
6610
  }
6611
6611
  function remainingWait(time) {
@@ -6621,7 +6621,7 @@ var require_lodash = __commonJS({
6621
6621
  if (shouldInvoke(time)) {
6622
6622
  return trailingEdge(time);
6623
6623
  }
6624
- timerId = setTimeout(timerExpired, remainingWait(time));
6624
+ timerId = setTimeout2(timerExpired, remainingWait(time));
6625
6625
  }
6626
6626
  function trailingEdge(time) {
6627
6627
  timerId = undefined2;
@@ -6652,12 +6652,12 @@ var require_lodash = __commonJS({
6652
6652
  }
6653
6653
  if (maxing) {
6654
6654
  clearTimeout(timerId);
6655
- timerId = setTimeout(timerExpired, wait);
6655
+ timerId = setTimeout2(timerExpired, wait);
6656
6656
  return invokeFunc(lastCallTime);
6657
6657
  }
6658
6658
  }
6659
6659
  if (timerId === undefined2) {
6660
- timerId = setTimeout(timerExpired, wait);
6660
+ timerId = setTimeout2(timerExpired, wait);
6661
6661
  }
6662
6662
  return result2;
6663
6663
  }
@@ -11444,11 +11444,6 @@ var isEqual = (viewTableConfig, tableConfig, defaultViewConfig, provider) => {
11444
11444
  const normalizedCurrentConfig = normalizeForComparison(tableConfig);
11445
11445
  const cleanedViewConfig = cleanObject(normalizedViewConfig, provider);
11446
11446
  const cleanedCurrentConfig = cleanObject(normalizedCurrentConfig, provider);
11447
- console.log("xx:Difference between view config and current config:", {
11448
- viewConfig: cleanedViewConfig,
11449
- currentConfig: cleanedCurrentConfig,
11450
- areEqual: import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig)
11451
- });
11452
11447
  return import_lodash.default.isEqual(cleanedViewConfig, cleanedCurrentConfig);
11453
11448
  };
11454
11449
  var hasPermissionForViewLevel = (viewLevel, permissions) => {
@@ -11671,7 +11666,7 @@ var useDefaultView = (props) => {
11671
11666
  };
11672
11667
 
11673
11668
  // src/SavedViews/components/SavedViews/SmartGrid/useSmartGridConfig.ts
11674
- import { useState as useState3, useEffect as useEffect2 } from "react";
11669
+ import { useState as useState3, useEffect as useEffect2, useRef as useRef2 } from "react";
11675
11670
  var GRID_STATE_EVENTS = [
11676
11671
  "sortChanged",
11677
11672
  "filterOpened",
@@ -11690,10 +11685,14 @@ var useSmartGridConfig = (gridApi) => {
11690
11685
  const [config, setConfig] = useState3(
11691
11686
  () => getSmartGridConfig(gridApi)
11692
11687
  );
11688
+ const eventListenersDisabledRef = useRef2(false);
11693
11689
  useEffect2(() => {
11694
11690
  if (!gridApi)
11695
11691
  return;
11696
- const updateConfig = () => {
11692
+ const updateConfig = (par) => {
11693
+ if (eventListenersDisabledRef.current) {
11694
+ return;
11695
+ }
11697
11696
  setConfig(getSmartGridConfig(gridApi));
11698
11697
  };
11699
11698
  GRID_STATE_EVENTS.forEach((event) => {
@@ -11705,7 +11704,13 @@ var useSmartGridConfig = (gridApi) => {
11705
11704
  });
11706
11705
  };
11707
11706
  }, [gridApi]);
11708
- return { config, setConfig };
11707
+ const disableEventListeners = () => {
11708
+ eventListenersDisabledRef.current = true;
11709
+ };
11710
+ const enableEventListeners = () => {
11711
+ eventListenersDisabledRef.current = false;
11712
+ };
11713
+ return { config, setConfig, disableEventListeners, enableEventListeners };
11709
11714
  };
11710
11715
 
11711
11716
  // src/SavedViews/components/SavedViews/SavedViews.tsx
@@ -14095,7 +14100,7 @@ function extractMessage(error, I18n) {
14095
14100
  }
14096
14101
 
14097
14102
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14098
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14103
+ var { useEffect: useEffect3, useRef: useRef3 } = React17;
14099
14104
  var ScrollContainer = styled_components_esm_default("div")`
14100
14105
  overflow: auto;
14101
14106
  `;
@@ -14118,7 +14123,7 @@ var SavedViewsCreateUpdateModalBase = ({
14118
14123
  }) => {
14119
14124
  const I18n = useI18nContext7();
14120
14125
  const NAME_MAX_LENGTH = 150;
14121
- const originalBodyWidth = useRef2("");
14126
+ const originalBodyWidth = useRef3("");
14122
14127
  useEffect3(() => {
14123
14128
  if (open) {
14124
14129
  originalBodyWidth.current = document.body.style.width || "";
@@ -14629,7 +14634,12 @@ var SavedViews = (props) => {
14629
14634
  import { ToastAlertProvider } from "@procore/toast-alert";
14630
14635
  var SmartGridSavedViews = (props) => {
14631
14636
  const { gridApi, projectId, companyId } = props;
14632
- const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
14637
+ const {
14638
+ config: tableConfig,
14639
+ setConfig: setTableConfig,
14640
+ disableEventListeners,
14641
+ enableEventListeners
14642
+ } = useSmartGridConfig(gridApi);
14633
14643
  const defaultView = useDefaultView({
14634
14644
  defaultViewName: props.defaultViewName,
14635
14645
  domain: props.domain
@@ -14654,8 +14664,15 @@ var SmartGridSavedViews = (props) => {
14654
14664
  tableConfig2
14655
14665
  )
14656
14666
  };
14657
- updateTableConfig(updatedView, gridApi, "smart-grid");
14658
- setTableConfig(updatedView.table_config);
14667
+ disableEventListeners();
14668
+ try {
14669
+ updateTableConfig(updatedView, gridApi, "smart-grid");
14670
+ setTableConfig(updatedView.table_config);
14671
+ } finally {
14672
+ setTimeout(() => {
14673
+ enableEventListeners();
14674
+ }, 0);
14675
+ }
14659
14676
  return updatedView;
14660
14677
  };
14661
14678
  return /* @__PURE__ */ React20.createElement(ToastAlertProvider, null, /* @__PURE__ */ React20.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/saved-views",
3
- "version": "5.0.0-alpha.5",
3
+ "version": "5.0.0-alpha.6",
4
4
  "description": "Saved Views Component for Data Table",
5
5
  "author": "Procore Technologies, Inc",
6
6
  "repository": {