From ad91b128794b6afbe77f6669889dbcea0bba28de Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Tue, 18 Jul 2023 10:35:11 +0800 Subject: [PATCH] Fix react-beautiful-dnd warning in development Signed-off-by: Egor Savkin --- static/js/shop.jsx | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/static/js/shop.jsx b/static/js/shop.jsx index dcdddb1..116160e 100644 --- a/static/js/shop.jsx +++ b/static/js/shop.jsx @@ -406,6 +406,7 @@ class ProductItem extends React.PureComponent { static get propTypes() { return { id: PropTypes.string.isRequired, + index: PropTypes.number.isRequired, name: PropTypes.string.isRequired, name_codename: PropTypes.string, price: PropTypes.number.isRequired, @@ -433,6 +434,7 @@ class ProductItem extends React.PureComponent { render() { const { id, + index, name, name_codename, price, @@ -482,7 +484,7 @@ class ProductItem extends React.PureComponent { add - + {(provided, snapshot) => ( ({ name: groupItem.name, items: groupItem.itemIds.map(itemId => items[itemId]) })); - const groups = ordered_groups.map((group, g_index) => { + let item_index = -1; + const groups = ordered_groups.map((group, g_index) => { return (

@@ -1522,21 +1525,24 @@ class Backlog extends React.PureComponent {
- {group.items.map(item => ( - - ))} + {group.items.map(item => { + item_index++; + return ( + + )})}