gantt-task-react-powern 0.6.6 → 0.6.7

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.js CHANGED
@@ -3088,6 +3088,8 @@ var Gantt = function Gantt(_ref) {
3088
3088
  barTasks = _useState6[0],
3089
3089
  setBarTasks = _useState6[1];
3090
3090
 
3091
+ var debounceRef = React.useRef(null);
3092
+
3091
3093
  var _useState7 = React.useState({
3092
3094
  action: ""
3093
3095
  }),
@@ -3141,7 +3143,13 @@ var Gantt = function Gantt(_ref) {
3141
3143
  }
3142
3144
  }, [startDate, endDate]);
3143
3145
  React.useEffect(function () {
3144
- var timer = setTimeout(function () {
3146
+ console.debug("Tasks or view mode changed, recalculating bars...");
3147
+
3148
+ if (debounceRef.current) {
3149
+ clearTimeout(debounceRef.current);
3150
+ }
3151
+
3152
+ debounceRef.current = setTimeout(function () {
3145
3153
  var filteredTasks;
3146
3154
 
3147
3155
  if (onExpanderClick) {
@@ -3190,10 +3198,12 @@ var Gantt = function Gantt(_ref) {
3190
3198
 
3191
3199
  setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
3192
3200
  }, delayToRender);
3201
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, onExpanderClick]);
3202
+ React.useEffect(function () {
3193
3203
  return function () {
3194
- return clearTimeout(timer);
3204
+ clearTimeout(debounceRef.current);
3195
3205
  };
3196
- }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, onExpanderClick]);
3206
+ }, []);
3197
3207
  React.useEffect(function () {
3198
3208
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
3199
3209
  var dates = dateSetup.dates;