From fd02261a66d80892a95e9e9ae4cbfe2779d4643c Mon Sep 17 00:00:00 2001 From: Iuri Wollmann Date: Wed, 7 Feb 2024 11:30:06 -0300 Subject: [PATCH] fix(dnd): move merge components Resolves issue with using the DnD HOC where components are not receiving state updates #2359 --- src/addons/dragAndDrop/withDragAndDrop.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/addons/dragAndDrop/withDragAndDrop.js b/src/addons/dragAndDrop/withDragAndDrop.js index 8dfd8da6b..bbc188c15 100644 --- a/src/addons/dragAndDrop/withDragAndDrop.js +++ b/src/addons/dragAndDrop/withDragAndDrop.js @@ -39,14 +39,6 @@ export default function withDragAndDrop(Calendar) { constructor(...args) { super(...args) - const { components } = this.props - - this.components = mergeComponents(components, { - eventWrapper: EventWrapper, - eventContainerWrapper: EventContainerWrapper, - weekWrapper: WeekWrapper, - }) - this.state = { interacting: false } } @@ -99,13 +91,19 @@ export default function withDragAndDrop(Calendar) { } render() { - const { selectable, elementProps, ...props } = this.props + const { selectable, elementProps, components, ...props } = this.props const { interacting } = this.state delete props.onEventDrop delete props.onEventResize props.selectable = selectable ? 'ignoreEvents' : false + this.components = mergeComponents(components, { + eventWrapper: EventWrapper, + eventContainerWrapper: EventContainerWrapper, + weekWrapper: WeekWrapper, + }) + const elementPropsWithDropFromOutside = this.props.onDropFromOutside ? { ...elementProps,