From c7893c5af7c13a9326f15a6b917346510ea3ef52 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Wed, 4 Dec 2024 14:24:34 +0530 Subject: [PATCH 1/2] remove shouldEnable dependency flags for timeline view --- .../helpers/blockResizables/use-gantt-resizable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts index e6a1a887e0c..40283e71733 100644 --- a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts +++ b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts @@ -103,7 +103,7 @@ export const useGanttResizable = ( const deltaWidth = Math.round((width - (block.position?.width ?? 0)) / dayWidth) * dayWidth; // 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 @@ -119,7 +119,7 @@ export const useGanttResizable = ( (dragDirection === "left" && !block.start_date) || (dragDirection === "right" && !block.target_date); try { - const blockUpdates = getUpdatedPositionAfterDrag(block.id, shouldUpdateHalfBlock, dragDirection !== "move"); + const blockUpdates = getUpdatedPositionAfterDrag(block.id, shouldUpdateHalfBlock); updateBlockDates && updateBlockDates(blockUpdates); } catch (e) { setToast; From 32268bfb48e8a63ccb7f9982eb8bfd3d83910bad Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Tue, 10 Dec 2024 13:15:53 +0530 Subject: [PATCH 2/2] chore: error handling --- .../helpers/blockResizables/use-gantt-resizable.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts index 40283e71733..c96a2572502 100644 --- a/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts +++ b/web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts @@ -1,6 +1,6 @@ import { useRef, useState } from "react"; // Plane -import { setToast } from "@plane/ui"; +import { setToast, TOAST_TYPE } from "@plane/ui"; // hooks import { useTimeLineChartStore } from "@/hooks/use-timeline-chart"; // @@ -120,9 +120,13 @@ export const useGanttResizable = ( try { const blockUpdates = getUpdatedPositionAfterDrag(block.id, shouldUpdateHalfBlock); - updateBlockDates && updateBlockDates(blockUpdates); - } catch (e) { - setToast; + if (updateBlockDates) updateBlockDates(blockUpdates); + } catch { + setToast({ + type: TOAST_TYPE.ERROR, + title: "Error", + message: "Something went wrong while updating block dates", + }); } setIsDragging(false);