Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
fix(dnd): move merge components
Browse files Browse the repository at this point in the history
Resolves issue with using the DnD HOC where components are not receiving state updates

jquense#2359
  • Loading branch information
iwollmann committed Feb 7, 2024
1 parent 25dd638 commit fd02261
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/addons/dragAndDrop/withDragAndDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fd02261

Please sign in to comment.