chore: Remove shouldIgnoreDependencies flags while dragging in timeline view (#6150)
* remove shouldEnable dependency flags for timeline view * chore: error handling --------- Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
This commit is contained in:
parent
134644fdf1
commit
5a9ae66680
1 changed files with 10 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
// Plane
|
// Plane
|
||||||
import { setToast } from "@plane/ui";
|
import { setToast, TOAST_TYPE } from "@plane/ui";
|
||||||
// hooks
|
// hooks
|
||||||
import { useTimeLineChartStore } from "@/hooks/use-timeline-chart";
|
import { useTimeLineChartStore } from "@/hooks/use-timeline-chart";
|
||||||
//
|
//
|
||||||
|
|
@ -103,7 +103,7 @@ export const useGanttResizable = (
|
||||||
const deltaWidth = Math.round((width - (block.position?.width ?? 0)) / dayWidth) * dayWidth;
|
const deltaWidth = Math.round((width - (block.position?.width ?? 0)) / dayWidth) * dayWidth;
|
||||||
|
|
||||||
// call update blockPosition
|
// call update blockPosition
|
||||||
if (deltaWidth || deltaLeft) updateBlockPosition(block.id, deltaLeft, deltaWidth, dragDirection !== "move");
|
if (deltaWidth || deltaLeft) updateBlockPosition(block.id, deltaLeft, deltaWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
// remove event listeners and call updateBlockDates
|
// remove event listeners and call updateBlockDates
|
||||||
|
|
@ -119,10 +119,14 @@ export const useGanttResizable = (
|
||||||
(dragDirection === "left" && !block.start_date) || (dragDirection === "right" && !block.target_date);
|
(dragDirection === "left" && !block.start_date) || (dragDirection === "right" && !block.target_date);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const blockUpdates = getUpdatedPositionAfterDrag(block.id, shouldUpdateHalfBlock, dragDirection !== "move");
|
const blockUpdates = getUpdatedPositionAfterDrag(block.id, shouldUpdateHalfBlock);
|
||||||
updateBlockDates && updateBlockDates(blockUpdates);
|
if (updateBlockDates) updateBlockDates(blockUpdates);
|
||||||
} catch (e) {
|
} catch {
|
||||||
setToast;
|
setToast({
|
||||||
|
type: TOAST_TYPE.ERROR,
|
||||||
|
title: "Error",
|
||||||
|
message: "Something went wrong while updating block dates",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsDragging(false);
|
setIsDragging(false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue