project-icp / bee-pollinator-app

The web application front end for the ICP Pollinator Decision Support Tool 🐝
Apache License 2.0
6 stars 1 forks source link

Apiary Addition Broken After Sort #437

Closed rajadain closed 5 years ago

rajadain commented 5 years ago

Because the visual sorting of apiary cards is done by sorting the list of apiaries in place:

https://github.com/project-icp/bee-pollinator-app/blob/6204798cb3cf52a7ce601b603ff7137080166aee/src/icp/apps/beekeepers/js/src/components/Sidebar.jsx#L41-L58

Adding an apiary if sorting by anything other than the default sort causes the marker assignment to fail. For example, in this case, the latest apiary was assigned "B" instead of "D", because the last apiary in the sequence had the marker "A":

image

Fix this by making a copy of the array from Redux and sorting that. Or by generating a list of ApiaryCards from the Redux array and sorting that.