gantt-lib 0.135.6 → 0.135.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.mjs CHANGED
@@ -1626,18 +1626,16 @@ function reflowTasksOnModeSwitch(sourceTasks, toBusinessDays, weekendPredicate)
1626
1626
  function buildAdjacencyList(tasks) {
1627
1627
  const graph = /* @__PURE__ */ new Map();
1628
1628
  for (const task of tasks) {
1629
- const successors = [];
1630
- for (const otherTask of tasks) {
1631
- if (otherTask.dependencies) {
1632
- for (const dep of otherTask.dependencies) {
1633
- if (dep.taskId === task.id) {
1634
- successors.push(otherTask.id);
1635
- break;
1636
- }
1637
- }
1629
+ graph.set(task.id, []);
1630
+ }
1631
+ for (const task of tasks) {
1632
+ if (!task.dependencies) continue;
1633
+ for (const dep of task.dependencies) {
1634
+ const bucket = graph.get(dep.taskId);
1635
+ if (bucket) {
1636
+ bucket.push(task.id);
1638
1637
  }
1639
1638
  }
1640
- graph.set(task.id, successors);
1641
1639
  }
1642
1640
  return graph;
1643
1641
  }
@@ -4964,12 +4962,12 @@ var DependencyLines = React6.memo(({
4964
4962
  }
4965
4963
  return { taskPositions: positions, taskIndices: indices, hiddenTaskIds: hidden };
4966
4964
  }, [tasks, tasksForPositions, allTasks, collapsedParentIds, monthStart, dayWidth, rowHeight, dragOverrides, rowIndexByTaskId]);
4965
+ const tasksForCycleDetection = allTasks ?? tasks;
4967
4966
  const cycleInfo = useMemo6(() => {
4968
- const tasksForCycleDetection = allTasks ?? tasks;
4969
4967
  const result = detectCycles(tasksForCycleDetection);
4970
4968
  const cycleTaskIds = new Set(result.cyclePath || []);
4971
4969
  return cycleTaskIds;
4972
- }, [tasks, allTasks]);
4970
+ }, [tasksForCycleDetection]);
4973
4971
  const lines = useMemo6(() => {
4974
4972
  const tasksForEdges = allTasks ?? tasks;
4975
4973
  const taskMap = new Map(tasksForEdges.map((task) => [task.id, task]));