From 39efc3935f73b4ca8a6e84d5dd8b5971c709343b Mon Sep 17 00:00:00 2001 From: Gerson Dias Date: Mon, 30 Dec 2024 21:08:56 -0300 Subject: [PATCH] fix: better prop management to not trigger runtime warnings BoardContainer and Lane was not handling props correctly, resulting invalid DOM properties to be present in the final DOM, resulting in runtime warnings --- src/controllers/BoardContainer.js | 36 ++++++++++++++++++++-------- src/controllers/Lane.js | 40 ++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 18 deletions(-) diff --git a/src/controllers/BoardContainer.js b/src/controllers/BoardContainer.js index 7603b894..ac0ba48d 100644 --- a/src/controllers/BoardContainer.js +++ b/src/controllers/BoardContainer.js @@ -114,28 +114,42 @@ class BoardContainer extends Component { const { id, components, + actions, + data, reducerData, - draggable, - laneDraggable, - laneDragClass, - laneDropClass, - style, onDataChange, - onCardAdd, - onCardUpdate, + eventBusHandle, + onLaneScroll, onCardClick, onBeforeCardDelete, onCardDelete, - onLaneScroll, - onLaneClick, + onCardAdd, + onCardUpdate, onLaneAdd, onLaneDelete, + onLaneClick, onLaneUpdate, + laneSortFunction, + draggable, + collapsibleLanes, editable, canAddLanes, - laneStyle, + hideCardDeleteIcon, + handleDragStart, + handleDragEnd, + handleLaneDragStart, + handleLaneDragEnd, + style, + tagStyle, + laneDraggable, + cardDraggable, + cardDragClass, + laneDragClass, + laneDropClass, onCardMoveAcrossLanes, t, + cardStyle, + laneStyle, ...otherProps } = this.props @@ -251,6 +265,8 @@ BoardContainer.propTypes = { laneDropClass: PropTypes.string, onCardMoveAcrossLanes: PropTypes.func.isRequired, t: PropTypes.func.isRequired, + cardStyle: PropTypes.object, + laneStyle: PropTypes.object } BoardContainer.defaultProps = { diff --git a/src/controllers/Lane.js b/src/controllers/Lane.js index 3a8303a8..16d9f01b 100644 --- a/src/controllers/Lane.js +++ b/src/controllers/Lane.js @@ -242,20 +242,42 @@ class Lane extends Component { render() { const {loading, isDraggingOver, collapsed} = this.state const { + actions, id, + boardId, + title, + index, + laneSortFunction, + style, + cardStyle, + tagStyle, + titleStyle, + labelStyle, cards, + label, + currentPage, + draggable, collapsibleLanes, - components, - onLaneClick, - onLaneScroll, + droppable, + onCardMoveAcrossLanes, onCardClick, - onCardAdd, onBeforeCardDelete, onCardDelete, + onCardAdd, + onCardUpdate, onLaneDelete, onLaneUpdate, - onCardUpdate, - onCardMoveAcrossLanes, + onLaneClick, + onLaneScroll, + editable, + laneDraggable, + cardDraggable, + cardDragClass, + cardDropClass, + canAddLanes, + t, + components, + className, ...otherProps } = this.props const allClassNames = classNames('react-trello-lane', this.props.className || '') @@ -267,7 +289,7 @@ class Lane extends Component { onClick={() => onLaneClick && onLaneClick(id)} draggable={false} className={allClassNames}> - {this.renderHeader({id, cards, ...otherProps})} + {this.renderHeader({id, cards, t, ...otherProps})} {this.renderDragContainer(isDraggingOver)} {loading && } {showFooter && } @@ -310,7 +332,9 @@ Lane.propTypes = { cardDragClass: PropTypes.string, cardDropClass: PropTypes.string, canAddLanes: PropTypes.bool, - t: PropTypes.func.isRequired + t: PropTypes.func.isRequired, + components: PropTypes.object, + className: PropTypes.string } Lane.defaultProps = {