Skip to content

Commit 799a72a

Browse files
authored
fix: bug with dnd drag drop (jquense#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 jquense#2601
1 parent 5ae72e9 commit 799a72a

File tree

1 file changed

+4
-1
lines changed
  • stories/demos/exampleCode

1 file changed

+4
-1
lines changed

stories/demos/exampleCode/dnd.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ export default function DragAndDrop({ localizer }) {
1919
if (!allDay && droppedOnAllDaySlot) {
2020
event.allDay = true
2121
}
22+
if (allDay && !droppedOnAllDaySlot) {
23+
event.allDay = false;
24+
}
2225

2326
setMyEvents((prev) => {
2427
const existing = prev.find((ev) => ev.id === event.id) ?? {}
2528
const filtered = prev.filter((ev) => ev.id !== event.id)
26-
return [...filtered, { ...existing, start, end, allDay }]
29+
return [...filtered, { ...existing, start, end, allDay: event.allDay }]
2730
})
2831
},
2932
[setMyEvents]

0 commit comments

Comments
 (0)