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

Fix Apiary Add / Remove Behavior on Sort #442

Closed rajadain closed 5 years ago

rajadain commented 5 years ago

Overview

Previously, we would inadvertently sort the apiaries in place, causing their order in the redux state to be different. This interfered with the marker assignment for new apiaries, a function that assumes that the list in redux state is sorted by the default order.

Since changing the ordering of the redux state was inadvertent, this is now fixed by making a deep copy and sorting that when a non-default sort order is specified.

Also fixes a small issue where the Header component's prop type check would fail because isStaff was undefined for non-logged-in users.

Connects #437

Demo

2019-01-28 11 55 06

Notes

The third commit 69bab1e basically wipes out the first two, so they could've been dropped, but I've preserved them to show the process of thought.

Testing Instructions