Skip to content

Commit

Permalink
fix: bug with dnd drag drop (#2602)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ganning127 authored May 14, 2024
1 parent 5ae72e9 commit 799a72a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion stories/demos/exampleCode/dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 799a72a

Please sign in to comment.