From 799a72ad5d1782f4d8518e834585728c32e1b7e3 Mon Sep 17 00:00:00 2001 From: Ganning Xu Date: Wed, 15 May 2024 03:04:01 +0800 Subject: [PATCH] fix: bug with dnd drag drop (#2602) Added an if statement to account for the second case, and changed the updated state value to use the correct allDay value (Thanks to ganning127) closes #2601 --- stories/demos/exampleCode/dnd.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stories/demos/exampleCode/dnd.js b/stories/demos/exampleCode/dnd.js index 79e7e0617..1372eafcd 100644 --- a/stories/demos/exampleCode/dnd.js +++ b/stories/demos/exampleCode/dnd.js @@ -19,11 +19,14 @@ export default function DragAndDrop({ localizer }) { if (!allDay && droppedOnAllDaySlot) { event.allDay = true } + if (allDay && !droppedOnAllDaySlot) { + event.allDay = false; + } setMyEvents((prev) => { const existing = prev.find((ev) => ev.id === event.id) ?? {} const filtered = prev.filter((ev) => ev.id !== event.id) - return [...filtered, { ...existing, start, end, allDay }] + return [...filtered, { ...existing, start, end, allDay: event.allDay }] }) }, [setMyEvents]