react-beautiful-dnd-grid icon indicating copy to clipboard operation
react-beautiful-dnd-grid copied to clipboard

Not rerender grid if change props maxItems

Open malytinKonstantin opened this issue 6 years ago • 3 comments

<ListManager
  items={this.pages}
  direction="horizontal"
  maxItems={this.props.imageSize}
  render={this.$renderImageView}
  onDragEnd={this.handleDrop}
/>

malytinKonstantin avatar Jun 21 '19 08:06 malytinKonstantin

@malytinKonstantin did solve this issue ?!

atefBB avatar Sep 29 '22 12:09 atefBB

did anyone able to solve this ?

AjayShivanagol avatar May 16 '24 20:05 AjayShivanagol

did anyone able to solve this ?

use cann add componentdisupdate to listen for the change of maxItems componentDidUpdate(prevProps: Omit<P, Props> & WithMaxItemsProps) { if (prevProps.maxItems !== this.props.maxItems || prevProps.items !== this.props.items) { const maxItems = this.props.maxItems && this.props.maxItems > 0 ? this.props.maxItems : this.props.items.length

    this.setState({
      maxItems,
      items: this.props.items,
      chunks: splitItems(maxItems, this.props.items, createId)
    })
  }
}

Quy1e99 avatar Aug 20 '24 09:08 Quy1e99